b25964254133a8209cd77cdf0a751c1d5cb70319
[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 LDKBolt11SemanticError LDKBolt11SemanticError_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 Bolt11SemanticError.ordinal() from rust threw an exception.");
251         }
252         switch (ord) {
253                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
254                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
255                 case 2: return LDKBolt11SemanticError_NoDescription;
256                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
257                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
258                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
259                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
260                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
261                 case 8: return LDKBolt11SemanticError_InvalidSignature;
262                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
263         }
264         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
265         abort(); // Unreachable, but will let the compiler know we don't return here
266 }
267 static jclass Bolt11SemanticError_class = NULL;
268 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
269 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
270 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
271 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
272 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
273 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
274 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
275 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
276 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
277 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
278 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
279         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
280         CHECK(Bolt11SemanticError_class != NULL);
281         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
282         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
283         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
284         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
285         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
286         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
287         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
288         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
289         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
290         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
291         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
292         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
293         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
294         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
295         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
296         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
297         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
298         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
299         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
300         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
301 }
302 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
303         switch (val) {
304                 case LDKBolt11SemanticError_NoPaymentHash:
305                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
306                 case LDKBolt11SemanticError_MultiplePaymentHashes:
307                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
308                 case LDKBolt11SemanticError_NoDescription:
309                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
310                 case LDKBolt11SemanticError_MultipleDescriptions:
311                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
312                 case LDKBolt11SemanticError_NoPaymentSecret:
313                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
314                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
315                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
316                 case LDKBolt11SemanticError_InvalidFeatures:
317                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
318                 case LDKBolt11SemanticError_InvalidRecoveryId:
319                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
320                 case LDKBolt11SemanticError_InvalidSignature:
321                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
322                 case LDKBolt11SemanticError_ImpreciseAmount:
323                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
324                 default: abort();
325         }
326 }
327
328 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
329         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
330         if (UNLIKELY((*env)->ExceptionCheck(env))) {
331                 (*env)->ExceptionDescribe(env);
332                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
333         }
334         switch (ord) {
335                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
336                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
337                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
338                 case 3: return LDKBolt12SemanticError_MissingAmount;
339                 case 4: return LDKBolt12SemanticError_InvalidAmount;
340                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
341                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
342                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
343                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
344                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
345                 case 10: return LDKBolt12SemanticError_MissingDescription;
346                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
347                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
348                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
349                 case 14: return LDKBolt12SemanticError_MissingQuantity;
350                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
351                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
352                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
353                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
354                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
355                 case 20: return LDKBolt12SemanticError_MissingPayerId;
356                 case 21: return LDKBolt12SemanticError_MissingPaths;
357                 case 22: return LDKBolt12SemanticError_InvalidPayInfo;
358                 case 23: return LDKBolt12SemanticError_MissingCreationTime;
359                 case 24: return LDKBolt12SemanticError_MissingPaymentHash;
360                 case 25: return LDKBolt12SemanticError_MissingSignature;
361         }
362         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
363         abort(); // Unreachable, but will let the compiler know we don't return here
364 }
365 static jclass Bolt12SemanticError_class = NULL;
366 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
367 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
368 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
369 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
370 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
371 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
372 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
373 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
374 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
375 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
376 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
377 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
378 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
379 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
380 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
381 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
382 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
383 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
384 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
385 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
386 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
387 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
388 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
389 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
390 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
391 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
392 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
393         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
394         CHECK(Bolt12SemanticError_class != NULL);
395         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
396         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
397         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
398         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
399         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
400         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
401         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
402         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
403         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
404         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
405         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
406         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
407         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
408         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
409         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
410         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
411         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
412         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
413         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
414         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
415         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
416         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
417         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
418         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
419         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
420         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
421         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
422         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
423         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
424         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
425         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
426         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
427         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
428         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
429         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
430         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
431         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
432         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
433         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
434         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
447 }
448 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
449         switch (val) {
450                 case LDKBolt12SemanticError_AlreadyExpired:
451                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
452                 case LDKBolt12SemanticError_UnsupportedChain:
453                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
454                 case LDKBolt12SemanticError_UnexpectedChain:
455                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
456                 case LDKBolt12SemanticError_MissingAmount:
457                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
458                 case LDKBolt12SemanticError_InvalidAmount:
459                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
460                 case LDKBolt12SemanticError_InsufficientAmount:
461                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
462                 case LDKBolt12SemanticError_UnexpectedAmount:
463                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
464                 case LDKBolt12SemanticError_UnsupportedCurrency:
465                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
466                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
467                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
468                 case LDKBolt12SemanticError_UnexpectedFeatures:
469                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
470                 case LDKBolt12SemanticError_MissingDescription:
471                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
472                 case LDKBolt12SemanticError_MissingSigningPubkey:
473                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
474                 case LDKBolt12SemanticError_InvalidSigningPubkey:
475                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
476                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
477                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
478                 case LDKBolt12SemanticError_MissingQuantity:
479                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
480                 case LDKBolt12SemanticError_InvalidQuantity:
481                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
482                 case LDKBolt12SemanticError_UnexpectedQuantity:
483                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
484                 case LDKBolt12SemanticError_InvalidMetadata:
485                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
486                 case LDKBolt12SemanticError_UnexpectedMetadata:
487                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
488                 case LDKBolt12SemanticError_MissingPayerMetadata:
489                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
490                 case LDKBolt12SemanticError_MissingPayerId:
491                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
492                 case LDKBolt12SemanticError_MissingPaths:
493                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
494                 case LDKBolt12SemanticError_InvalidPayInfo:
495                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
496                 case LDKBolt12SemanticError_MissingCreationTime:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
498                 case LDKBolt12SemanticError_MissingPaymentHash:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
500                 case LDKBolt12SemanticError_MissingSignature:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
502                 default: abort();
503         }
504 }
505
506 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
507         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
508         if (UNLIKELY((*env)->ExceptionCheck(env))) {
509                 (*env)->ExceptionDescribe(env);
510                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
511         }
512         switch (ord) {
513                 case 0: return LDKCOption_NoneZ_Some;
514                 case 1: return LDKCOption_NoneZ_None;
515         }
516         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
517         abort(); // Unreachable, but will let the compiler know we don't return here
518 }
519 static jclass COption_NoneZ_class = NULL;
520 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
521 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
522 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
523         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
524         CHECK(COption_NoneZ_class != NULL);
525         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
526         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
527         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
528         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
529 }
530 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
531         switch (val) {
532                 case LDKCOption_NoneZ_Some:
533                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
534                 case LDKCOption_NoneZ_None:
535                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
536                 default: abort();
537         }
538 }
539
540 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
541         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
542         if (UNLIKELY((*env)->ExceptionCheck(env))) {
543                 (*env)->ExceptionDescribe(env);
544                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
545         }
546         switch (ord) {
547                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
548                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
549                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
550         }
551         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
552         abort(); // Unreachable, but will let the compiler know we don't return here
553 }
554 static jclass ChannelMonitorUpdateStatus_class = NULL;
555 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
556 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
557 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
558 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
559         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
560         CHECK(ChannelMonitorUpdateStatus_class != NULL);
561         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
562         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
563         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
564         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
565         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
566         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
567 }
568 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
569         switch (val) {
570                 case LDKChannelMonitorUpdateStatus_Completed:
571                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
572                 case LDKChannelMonitorUpdateStatus_InProgress:
573                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
574                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
575                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
576                 default: abort();
577         }
578 }
579
580 static inline LDKChannelShutdownState LDKChannelShutdownState_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 ChannelShutdownState.ordinal() from rust threw an exception.");
585         }
586         switch (ord) {
587                 case 0: return LDKChannelShutdownState_NotShuttingDown;
588                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
589                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
590                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
591                 case 4: return LDKChannelShutdownState_ShutdownComplete;
592         }
593         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
594         abort(); // Unreachable, but will let the compiler know we don't return here
595 }
596 static jclass ChannelShutdownState_class = NULL;
597 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
598 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
599 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
600 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
601 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
602 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
603         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
604         CHECK(ChannelShutdownState_class != NULL);
605         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
606         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
607         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
608         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
609         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
610         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
611         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
612         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
613         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
614         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
615 }
616 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
617         switch (val) {
618                 case LDKChannelShutdownState_NotShuttingDown:
619                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
620                 case LDKChannelShutdownState_ShutdownInitiated:
621                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
622                 case LDKChannelShutdownState_ResolvingHTLCs:
623                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
624                 case LDKChannelShutdownState_NegotiatingClosingFee:
625                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
626                 case LDKChannelShutdownState_ShutdownComplete:
627                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
628                 default: abort();
629         }
630 }
631
632 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
633         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
634         if (UNLIKELY((*env)->ExceptionCheck(env))) {
635                 (*env)->ExceptionDescribe(env);
636                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
637         }
638         switch (ord) {
639                 case 0: return LDKConfirmationTarget_MempoolMinimum;
640                 case 1: return LDKConfirmationTarget_Background;
641                 case 2: return LDKConfirmationTarget_Normal;
642                 case 3: return LDKConfirmationTarget_HighPriority;
643         }
644         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
645         abort(); // Unreachable, but will let the compiler know we don't return here
646 }
647 static jclass ConfirmationTarget_class = NULL;
648 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = NULL;
649 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
650 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
651 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
653         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
654         CHECK(ConfirmationTarget_class != NULL);
655         ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MempoolMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
656         CHECK(ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum != NULL);
657         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
658         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
659         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
660         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
661         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
662         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
663 }
664 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
665         switch (val) {
666                 case LDKConfirmationTarget_MempoolMinimum:
667                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum);
668                 case LDKConfirmationTarget_Background:
669                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
670                 case LDKConfirmationTarget_Normal:
671                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
672                 case LDKConfirmationTarget_HighPriority:
673                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
674                 default: abort();
675         }
676 }
677
678 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
679         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
680         if (UNLIKELY((*env)->ExceptionCheck(env))) {
681                 (*env)->ExceptionDescribe(env);
682                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
683         }
684         switch (ord) {
685                 case 0: return LDKCreationError_DescriptionTooLong;
686                 case 1: return LDKCreationError_RouteTooLong;
687                 case 2: return LDKCreationError_TimestampOutOfBounds;
688                 case 3: return LDKCreationError_InvalidAmount;
689                 case 4: return LDKCreationError_MissingRouteHints;
690                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
691         }
692         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
693         abort(); // Unreachable, but will let the compiler know we don't return here
694 }
695 static jclass CreationError_class = NULL;
696 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
697 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
698 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
699 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
700 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
701 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
702 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
703         CreationError_class = (*env)->NewGlobalRef(env, clz);
704         CHECK(CreationError_class != NULL);
705         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
706         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
707         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
708         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
709         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
710         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
711         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
712         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
713         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
714         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
715         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
716         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
717 }
718 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
719         switch (val) {
720                 case LDKCreationError_DescriptionTooLong:
721                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
722                 case LDKCreationError_RouteTooLong:
723                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
724                 case LDKCreationError_TimestampOutOfBounds:
725                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
726                 case LDKCreationError_InvalidAmount:
727                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
728                 case LDKCreationError_MissingRouteHints:
729                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
730                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
731                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
732                 default: abort();
733         }
734 }
735
736 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
737         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
738         if (UNLIKELY((*env)->ExceptionCheck(env))) {
739                 (*env)->ExceptionDescribe(env);
740                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
741         }
742         switch (ord) {
743                 case 0: return LDKCurrency_Bitcoin;
744                 case 1: return LDKCurrency_BitcoinTestnet;
745                 case 2: return LDKCurrency_Regtest;
746                 case 3: return LDKCurrency_Simnet;
747                 case 4: return LDKCurrency_Signet;
748         }
749         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
750         abort(); // Unreachable, but will let the compiler know we don't return here
751 }
752 static jclass Currency_class = NULL;
753 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
754 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
755 static jfieldID Currency_LDKCurrency_Regtest = NULL;
756 static jfieldID Currency_LDKCurrency_Simnet = NULL;
757 static jfieldID Currency_LDKCurrency_Signet = NULL;
758 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
759         Currency_class = (*env)->NewGlobalRef(env, clz);
760         CHECK(Currency_class != NULL);
761         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
762         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
763         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
764         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
765         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
766         CHECK(Currency_LDKCurrency_Regtest != NULL);
767         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
768         CHECK(Currency_LDKCurrency_Simnet != NULL);
769         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
770         CHECK(Currency_LDKCurrency_Signet != NULL);
771 }
772 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
773         switch (val) {
774                 case LDKCurrency_Bitcoin:
775                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
776                 case LDKCurrency_BitcoinTestnet:
777                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
778                 case LDKCurrency_Regtest:
779                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
780                 case LDKCurrency_Simnet:
781                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
782                 case LDKCurrency_Signet:
783                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
784                 default: abort();
785         }
786 }
787
788 static inline LDKHTLCClaim LDKHTLCClaim_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 HTLCClaim.ordinal() from rust threw an exception.");
793         }
794         switch (ord) {
795                 case 0: return LDKHTLCClaim_OfferedTimeout;
796                 case 1: return LDKHTLCClaim_OfferedPreimage;
797                 case 2: return LDKHTLCClaim_AcceptedTimeout;
798                 case 3: return LDKHTLCClaim_AcceptedPreimage;
799                 case 4: return LDKHTLCClaim_Revocation;
800         }
801         (*env)->FatalError(env, "A call to HTLCClaim.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 HTLCClaim_class = NULL;
805 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
806 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
807 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
808 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
809 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
810 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
811         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
812         CHECK(HTLCClaim_class != NULL);
813         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
814         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
815         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
816         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
817         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
818         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
819         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
820         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
821         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
822         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
823 }
824 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
825         switch (val) {
826                 case LDKHTLCClaim_OfferedTimeout:
827                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
828                 case LDKHTLCClaim_OfferedPreimage:
829                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
830                 case LDKHTLCClaim_AcceptedTimeout:
831                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
832                 case LDKHTLCClaim_AcceptedPreimage:
833                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
834                 case LDKHTLCClaim_Revocation:
835                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
836                 default: abort();
837         }
838 }
839
840 static inline LDKIOError LDKIOError_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 IOError.ordinal() from rust threw an exception.");
845         }
846         switch (ord) {
847                 case 0: return LDKIOError_NotFound;
848                 case 1: return LDKIOError_PermissionDenied;
849                 case 2: return LDKIOError_ConnectionRefused;
850                 case 3: return LDKIOError_ConnectionReset;
851                 case 4: return LDKIOError_ConnectionAborted;
852                 case 5: return LDKIOError_NotConnected;
853                 case 6: return LDKIOError_AddrInUse;
854                 case 7: return LDKIOError_AddrNotAvailable;
855                 case 8: return LDKIOError_BrokenPipe;
856                 case 9: return LDKIOError_AlreadyExists;
857                 case 10: return LDKIOError_WouldBlock;
858                 case 11: return LDKIOError_InvalidInput;
859                 case 12: return LDKIOError_InvalidData;
860                 case 13: return LDKIOError_TimedOut;
861                 case 14: return LDKIOError_WriteZero;
862                 case 15: return LDKIOError_Interrupted;
863                 case 16: return LDKIOError_Other;
864                 case 17: return LDKIOError_UnexpectedEof;
865         }
866         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
867         abort(); // Unreachable, but will let the compiler know we don't return here
868 }
869 static jclass IOError_class = NULL;
870 static jfieldID IOError_LDKIOError_NotFound = NULL;
871 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
872 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
873 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
874 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
875 static jfieldID IOError_LDKIOError_NotConnected = NULL;
876 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
877 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
878 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
879 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
880 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
881 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
882 static jfieldID IOError_LDKIOError_InvalidData = NULL;
883 static jfieldID IOError_LDKIOError_TimedOut = NULL;
884 static jfieldID IOError_LDKIOError_WriteZero = NULL;
885 static jfieldID IOError_LDKIOError_Interrupted = NULL;
886 static jfieldID IOError_LDKIOError_Other = NULL;
887 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
888 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
889         IOError_class = (*env)->NewGlobalRef(env, clz);
890         CHECK(IOError_class != NULL);
891         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
892         CHECK(IOError_LDKIOError_NotFound != NULL);
893         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
894         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
895         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
896         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
897         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
898         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
899         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
900         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
901         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
902         CHECK(IOError_LDKIOError_NotConnected != NULL);
903         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
904         CHECK(IOError_LDKIOError_AddrInUse != NULL);
905         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
906         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
907         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
908         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
909         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
910         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
911         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
912         CHECK(IOError_LDKIOError_WouldBlock != NULL);
913         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
914         CHECK(IOError_LDKIOError_InvalidInput != NULL);
915         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
916         CHECK(IOError_LDKIOError_InvalidData != NULL);
917         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
918         CHECK(IOError_LDKIOError_TimedOut != NULL);
919         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
920         CHECK(IOError_LDKIOError_WriteZero != NULL);
921         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
922         CHECK(IOError_LDKIOError_Interrupted != NULL);
923         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
924         CHECK(IOError_LDKIOError_Other != NULL);
925         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
926         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
927 }
928 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
929         switch (val) {
930                 case LDKIOError_NotFound:
931                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
932                 case LDKIOError_PermissionDenied:
933                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
934                 case LDKIOError_ConnectionRefused:
935                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
936                 case LDKIOError_ConnectionReset:
937                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
938                 case LDKIOError_ConnectionAborted:
939                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
940                 case LDKIOError_NotConnected:
941                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
942                 case LDKIOError_AddrInUse:
943                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
944                 case LDKIOError_AddrNotAvailable:
945                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
946                 case LDKIOError_BrokenPipe:
947                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
948                 case LDKIOError_AlreadyExists:
949                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
950                 case LDKIOError_WouldBlock:
951                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
952                 case LDKIOError_InvalidInput:
953                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
954                 case LDKIOError_InvalidData:
955                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
956                 case LDKIOError_TimedOut:
957                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
958                 case LDKIOError_WriteZero:
959                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
960                 case LDKIOError_Interrupted:
961                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
962                 case LDKIOError_Other:
963                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
964                 case LDKIOError_UnexpectedEof:
965                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
966                 default: abort();
967         }
968 }
969
970 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
971         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
972         if (UNLIKELY((*env)->ExceptionCheck(env))) {
973                 (*env)->ExceptionDescribe(env);
974                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
975         }
976         switch (ord) {
977                 case 0: return LDKLevel_Gossip;
978                 case 1: return LDKLevel_Trace;
979                 case 2: return LDKLevel_Debug;
980                 case 3: return LDKLevel_Info;
981                 case 4: return LDKLevel_Warn;
982                 case 5: return LDKLevel_Error;
983         }
984         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
985         abort(); // Unreachable, but will let the compiler know we don't return here
986 }
987 static jclass Level_class = NULL;
988 static jfieldID Level_LDKLevel_Gossip = NULL;
989 static jfieldID Level_LDKLevel_Trace = NULL;
990 static jfieldID Level_LDKLevel_Debug = NULL;
991 static jfieldID Level_LDKLevel_Info = NULL;
992 static jfieldID Level_LDKLevel_Warn = NULL;
993 static jfieldID Level_LDKLevel_Error = NULL;
994 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
995         Level_class = (*env)->NewGlobalRef(env, clz);
996         CHECK(Level_class != NULL);
997         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
998         CHECK(Level_LDKLevel_Gossip != NULL);
999         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1000         CHECK(Level_LDKLevel_Trace != NULL);
1001         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1002         CHECK(Level_LDKLevel_Debug != NULL);
1003         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1004         CHECK(Level_LDKLevel_Info != NULL);
1005         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1006         CHECK(Level_LDKLevel_Warn != NULL);
1007         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1008         CHECK(Level_LDKLevel_Error != NULL);
1009 }
1010 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1011         switch (val) {
1012                 case LDKLevel_Gossip:
1013                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1014                 case LDKLevel_Trace:
1015                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1016                 case LDKLevel_Debug:
1017                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1018                 case LDKLevel_Info:
1019                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1020                 case LDKLevel_Warn:
1021                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1022                 case LDKLevel_Error:
1023                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1024                 default: abort();
1025         }
1026 }
1027
1028 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1029         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1030         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1031                 (*env)->ExceptionDescribe(env);
1032                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1033         }
1034         switch (ord) {
1035                 case 0: return LDKNetwork_Bitcoin;
1036                 case 1: return LDKNetwork_Testnet;
1037                 case 2: return LDKNetwork_Regtest;
1038                 case 3: return LDKNetwork_Signet;
1039         }
1040         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1041         abort(); // Unreachable, but will let the compiler know we don't return here
1042 }
1043 static jclass Network_class = NULL;
1044 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1045 static jfieldID Network_LDKNetwork_Testnet = NULL;
1046 static jfieldID Network_LDKNetwork_Regtest = NULL;
1047 static jfieldID Network_LDKNetwork_Signet = NULL;
1048 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1049         Network_class = (*env)->NewGlobalRef(env, clz);
1050         CHECK(Network_class != NULL);
1051         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1052         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1053         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1054         CHECK(Network_LDKNetwork_Testnet != NULL);
1055         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1056         CHECK(Network_LDKNetwork_Regtest != NULL);
1057         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1058         CHECK(Network_LDKNetwork_Signet != NULL);
1059 }
1060 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1061         switch (val) {
1062                 case LDKNetwork_Bitcoin:
1063                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1064                 case LDKNetwork_Testnet:
1065                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1066                 case LDKNetwork_Regtest:
1067                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1068                 case LDKNetwork_Signet:
1069                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1070                 default: abort();
1071         }
1072 }
1073
1074 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1075         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1076         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1077                 (*env)->ExceptionDescribe(env);
1078                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1079         }
1080         switch (ord) {
1081                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1082                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1083                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1084                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1085                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1086                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1087         }
1088         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1089         abort(); // Unreachable, but will let the compiler know we don't return here
1090 }
1091 static jclass PaymentFailureReason_class = NULL;
1092 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1093 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1094 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1095 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1096 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1097 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1098 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1099         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1100         CHECK(PaymentFailureReason_class != NULL);
1101         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1102         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1103         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1104         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1105         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1106         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1107         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1108         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1109         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1110         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1111         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1112         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1113 }
1114 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1115         switch (val) {
1116                 case LDKPaymentFailureReason_RecipientRejected:
1117                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1118                 case LDKPaymentFailureReason_UserAbandoned:
1119                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1120                 case LDKPaymentFailureReason_RetriesExhausted:
1121                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1122                 case LDKPaymentFailureReason_PaymentExpired:
1123                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1124                 case LDKPaymentFailureReason_RouteNotFound:
1125                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1126                 case LDKPaymentFailureReason_UnexpectedError:
1127                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1128                 default: abort();
1129         }
1130 }
1131
1132 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1133         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1134         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1135                 (*env)->ExceptionDescribe(env);
1136                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1137         }
1138         switch (ord) {
1139                 case 0: return LDKRecipient_Node;
1140                 case 1: return LDKRecipient_PhantomNode;
1141         }
1142         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1143         abort(); // Unreachable, but will let the compiler know we don't return here
1144 }
1145 static jclass Recipient_class = NULL;
1146 static jfieldID Recipient_LDKRecipient_Node = NULL;
1147 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1148 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1149         Recipient_class = (*env)->NewGlobalRef(env, clz);
1150         CHECK(Recipient_class != NULL);
1151         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1152         CHECK(Recipient_LDKRecipient_Node != NULL);
1153         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1154         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1155 }
1156 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1157         switch (val) {
1158                 case LDKRecipient_Node:
1159                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1160                 case LDKRecipient_PhantomNode:
1161                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1162                 default: abort();
1163         }
1164 }
1165
1166 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1167         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1168         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1169                 (*env)->ExceptionDescribe(env);
1170                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1171         }
1172         switch (ord) {
1173                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1174                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1175                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1176         }
1177         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1178         abort(); // Unreachable, but will let the compiler know we don't return here
1179 }
1180 static jclass RetryableSendFailure_class = NULL;
1181 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1182 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1183 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1184 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1185         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1186         CHECK(RetryableSendFailure_class != NULL);
1187         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1188         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1189         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1190         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1191         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1192         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1193 }
1194 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1195         switch (val) {
1196                 case LDKRetryableSendFailure_PaymentExpired:
1197                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1198                 case LDKRetryableSendFailure_RouteNotFound:
1199                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1200                 case LDKRetryableSendFailure_DuplicatePayment:
1201                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1202                 default: abort();
1203         }
1204 }
1205
1206 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1207         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1208         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1209                 (*env)->ExceptionDescribe(env);
1210                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1211         }
1212         switch (ord) {
1213                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1214                 case 1: return LDKSecp256k1Error_InvalidMessage;
1215                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1216                 case 3: return LDKSecp256k1Error_InvalidSignature;
1217                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1218                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1219                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1220                 case 7: return LDKSecp256k1Error_InvalidTweak;
1221                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1222                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1223                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1224         }
1225         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1226         abort(); // Unreachable, but will let the compiler know we don't return here
1227 }
1228 static jclass Secp256k1Error_class = NULL;
1229 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1230 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1231 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1232 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1233 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1234 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1235 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1236 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1237 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1238 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1239 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1240 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1241         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1242         CHECK(Secp256k1Error_class != NULL);
1243         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1244         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1245         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1246         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1247         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1248         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1249         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1250         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1251         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1252         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1253         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1254         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1255         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1256         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1257         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1258         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1259         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1260         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1261         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1262         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1263         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1264         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1265 }
1266 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1267         switch (val) {
1268                 case LDKSecp256k1Error_IncorrectSignature:
1269                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1270                 case LDKSecp256k1Error_InvalidMessage:
1271                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1272                 case LDKSecp256k1Error_InvalidPublicKey:
1273                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1274                 case LDKSecp256k1Error_InvalidSignature:
1275                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1276                 case LDKSecp256k1Error_InvalidSecretKey:
1277                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1278                 case LDKSecp256k1Error_InvalidSharedSecret:
1279                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1280                 case LDKSecp256k1Error_InvalidRecoveryId:
1281                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1282                 case LDKSecp256k1Error_InvalidTweak:
1283                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1284                 case LDKSecp256k1Error_NotEnoughMemory:
1285                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1286                 case LDKSecp256k1Error_InvalidPublicKeySum:
1287                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1288                 case LDKSecp256k1Error_InvalidParityValue:
1289                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1290                 default: abort();
1291         }
1292 }
1293
1294 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1295         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1296         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1297                 (*env)->ExceptionDescribe(env);
1298                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1299         }
1300         switch (ord) {
1301                 case 0: return LDKSiPrefix_Milli;
1302                 case 1: return LDKSiPrefix_Micro;
1303                 case 2: return LDKSiPrefix_Nano;
1304                 case 3: return LDKSiPrefix_Pico;
1305         }
1306         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1307         abort(); // Unreachable, but will let the compiler know we don't return here
1308 }
1309 static jclass SiPrefix_class = NULL;
1310 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1311 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1312 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1313 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1314 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1315         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1316         CHECK(SiPrefix_class != NULL);
1317         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1318         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1319         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1320         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1321         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1322         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1323         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1324         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1325 }
1326 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1327         switch (val) {
1328                 case LDKSiPrefix_Milli:
1329                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1330                 case LDKSiPrefix_Micro:
1331                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1332                 case LDKSiPrefix_Nano:
1333                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1334                 case LDKSiPrefix_Pico:
1335                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1336                 default: abort();
1337         }
1338 }
1339
1340 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1341         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1342         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1343                 (*env)->ExceptionDescribe(env);
1344                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1345         }
1346         switch (ord) {
1347                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1348                 case 1: return LDKSocketAddressParseError_InvalidInput;
1349                 case 2: return LDKSocketAddressParseError_InvalidPort;
1350                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1351         }
1352         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1353         abort(); // Unreachable, but will let the compiler know we don't return here
1354 }
1355 static jclass SocketAddressParseError_class = NULL;
1356 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1357 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1358 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1359 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1360 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1361         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1362         CHECK(SocketAddressParseError_class != NULL);
1363         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1364         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1365         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1366         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1367         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1368         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1369         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1370         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1371 }
1372 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1373         switch (val) {
1374                 case LDKSocketAddressParseError_SocketAddrParse:
1375                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1376                 case LDKSocketAddressParseError_InvalidInput:
1377                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1378                 case LDKSocketAddressParseError_InvalidPort:
1379                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1380                 case LDKSocketAddressParseError_InvalidOnionV3:
1381                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1382                 default: abort();
1383         }
1384 }
1385
1386 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1387         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1388         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1389                 (*env)->ExceptionDescribe(env);
1390                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1391         }
1392         switch (ord) {
1393                 case 0: return LDKUtxoLookupError_UnknownChain;
1394                 case 1: return LDKUtxoLookupError_UnknownTx;
1395         }
1396         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1397         abort(); // Unreachable, but will let the compiler know we don't return here
1398 }
1399 static jclass UtxoLookupError_class = NULL;
1400 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1401 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1402 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1403         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1404         CHECK(UtxoLookupError_class != NULL);
1405         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1406         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1407         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1408         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1409 }
1410 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1411         switch (val) {
1412                 case LDKUtxoLookupError_UnknownChain:
1413                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1414                 case LDKUtxoLookupError_UnknownTx:
1415                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1416                 default: abort();
1417         }
1418 }
1419
1420 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1421         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1422         return ret;
1423 }
1424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1425         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1426         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1427         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1428         return ret_arr;
1429 }
1430
1431 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1433         if (!ptr_is_owned(thing)) return;
1434         void* thing_ptr = untag_ptr(thing);
1435         CHECK_ACCESS(thing_ptr);
1436         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1437         FREE(untag_ptr(thing));
1438         BigEndianScalar_free(thing_conv);
1439 }
1440
1441 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1442 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1443 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1444 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1445 static jclass LDKBech32Error_InvalidLength_class = NULL;
1446 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1447 static jclass LDKBech32Error_InvalidChar_class = NULL;
1448 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1449 static jclass LDKBech32Error_InvalidData_class = NULL;
1450 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1451 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1452 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1453 static jclass LDKBech32Error_MixedCase_class = NULL;
1454 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1456         LDKBech32Error_MissingSeparator_class =
1457                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1458         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1459         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1460         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1461         LDKBech32Error_InvalidChecksum_class =
1462                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1463         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1464         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1465         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1466         LDKBech32Error_InvalidLength_class =
1467                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1468         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1469         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1470         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1471         LDKBech32Error_InvalidChar_class =
1472                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1473         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1474         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1475         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1476         LDKBech32Error_InvalidData_class =
1477                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1478         CHECK(LDKBech32Error_InvalidData_class != NULL);
1479         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1480         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1481         LDKBech32Error_InvalidPadding_class =
1482                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1483         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1484         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1485         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1486         LDKBech32Error_MixedCase_class =
1487                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1488         CHECK(LDKBech32Error_MixedCase_class != NULL);
1489         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1490         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1491 }
1492 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1493         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1494         switch(obj->tag) {
1495                 case LDKBech32Error_MissingSeparator: {
1496                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1497                 }
1498                 case LDKBech32Error_InvalidChecksum: {
1499                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1500                 }
1501                 case LDKBech32Error_InvalidLength: {
1502                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1503                 }
1504                 case LDKBech32Error_InvalidChar: {
1505                         int32_t invalid_char_conv = obj->invalid_char;
1506                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1507                 }
1508                 case LDKBech32Error_InvalidData: {
1509                         int8_t invalid_data_conv = obj->invalid_data;
1510                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1511                 }
1512                 case LDKBech32Error_InvalidPadding: {
1513                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1514                 }
1515                 case LDKBech32Error_MixedCase: {
1516                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1517                 }
1518                 default: abort();
1519         }
1520 }
1521 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1522         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1523         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1524         return ret;
1525 }
1526 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t thing) {
1527         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1528         LDKWitness ret_var = TxIn_get_witness(thing_conv);
1529         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1530         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1531         Witness_free(ret_var);
1532         return ret_arr;
1533 }
1534
1535 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t thing) {
1536         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1537         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
1538         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1539         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1540         CVec_u8Z_free(ret_var);
1541         return ret_arr;
1542 }
1543
1544 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t thing) {
1545         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1546         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1547         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(thing_conv).data);
1548         return ret_arr;
1549 }
1550
1551 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t thing) {
1552         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1553         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
1554         return ret_conv;
1555 }
1556
1557 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t thing) {
1558         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1559         int32_t ret_conv = TxIn_get_sequence(thing_conv);
1560         return ret_conv;
1561 }
1562
1563 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
1564         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1565         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1566         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1567         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1568         CVec_u8Z_free(ret_var);
1569         return ret_arr;
1570 }
1571
1572 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
1573         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1574         int64_t ret_conv = TxOut_get_value(thing_conv);
1575         return ret_conv;
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)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                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2205                 }
2206                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2207                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2208                         int64_t delayed_payment_output_ref = 0;
2209                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2210                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2211                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2212                 }
2213                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2214                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2215                         int64_t static_payment_output_ref = 0;
2216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2217                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2218                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2219                 }
2220                 default: abort();
2221         }
2222 }
2223 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2224 CHECK(owner->result_ok);
2225         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2226 }
2227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2228         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2229         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2230         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2231         int64_t ret_ref = tag_ptr(ret_copy, true);
2232         return ret_ref;
2233 }
2234
2235 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2236 CHECK(!owner->result_ok);
2237         return DecodeError_clone(&*owner->contents.err);
2238 }
2239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2240         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2241         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2242         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2243         int64_t ret_ref = tag_ptr(ret_copy, true);
2244         return ret_ref;
2245 }
2246
2247 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2248         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2249         for (size_t i = 0; i < ret.datalen; i++) {
2250                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2251         }
2252         return ret;
2253 }
2254 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2255         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2256         for (size_t i = 0; i < ret.datalen; i++) {
2257                 ret.data[i] = TxOut_clone(&orig->data[i]);
2258         }
2259         return ret;
2260 }
2261 static jclass LDKCOption_u32Z_Some_class = NULL;
2262 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2263 static jclass LDKCOption_u32Z_None_class = NULL;
2264 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2266         LDKCOption_u32Z_Some_class =
2267                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2268         CHECK(LDKCOption_u32Z_Some_class != NULL);
2269         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2270         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2271         LDKCOption_u32Z_None_class =
2272                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2273         CHECK(LDKCOption_u32Z_None_class != NULL);
2274         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2275         CHECK(LDKCOption_u32Z_None_meth != NULL);
2276 }
2277 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2278         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2279         switch(obj->tag) {
2280                 case LDKCOption_u32Z_Some: {
2281                         int32_t some_conv = obj->some;
2282                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2283                 }
2284                 case LDKCOption_u32Z_None: {
2285                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2286                 }
2287                 default: abort();
2288         }
2289 }
2290 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2291         return CVec_u8Z_clone(&owner->a);
2292 }
2293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2294         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2295         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
2296         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2297         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2298         CVec_u8Z_free(ret_var);
2299         return ret_arr;
2300 }
2301
2302 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2303         return owner->b;
2304 }
2305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2306         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2307         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
2308         return ret_conv;
2309 }
2310
2311 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2312 CHECK(owner->result_ok);
2313         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
2314 }
2315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2316         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2317         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
2318         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
2319         return tag_ptr(ret_conv, true);
2320 }
2321
2322 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2323 CHECK(!owner->result_ok);
2324         return *owner->contents.err;
2325 }
2326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2327         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2328         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
2329 }
2330
2331 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2332 CHECK(owner->result_ok);
2333         return *owner->contents.result;
2334 }
2335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2336         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2337         CResult_NoneNoneZ_get_ok(owner_conv);
2338 }
2339
2340 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2341 CHECK(!owner->result_ok);
2342         return *owner->contents.err;
2343 }
2344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2345         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2346         CResult_NoneNoneZ_get_err(owner_conv);
2347 }
2348
2349 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2350         return owner->a;
2351 }
2352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2353         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2354         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2355         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2356         return ret_arr;
2357 }
2358
2359 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2360         return owner->b;
2361 }
2362 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2363         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2364         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2365         jobjectArray ret_arr = NULL;
2366         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2367         ;
2368         for (size_t i = 0; i < ret_var.datalen; i++) {
2369                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2370                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2371                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2372         }
2373         
2374         return ret_arr;
2375 }
2376
2377 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2378 CHECK(owner->result_ok);
2379         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2380 }
2381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2382         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2383         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2384         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2385         return tag_ptr(ret_conv, true);
2386 }
2387
2388 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2389 CHECK(!owner->result_ok);
2390         return *owner->contents.err;
2391 }
2392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2393         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2394         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2395 }
2396
2397 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2398 CHECK(owner->result_ok);
2399         return *owner->contents.result;
2400 }
2401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2402         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2403         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2404         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2405         return ret_arr;
2406 }
2407
2408 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2409 CHECK(!owner->result_ok);
2410         return *owner->contents.err;
2411 }
2412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2413         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2414         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2415 }
2416
2417 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2418 CHECK(owner->result_ok);
2419         return *owner->contents.result;
2420 }
2421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2422         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2423         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2424         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2425         return ret_arr;
2426 }
2427
2428 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2429 CHECK(!owner->result_ok);
2430         return *owner->contents.err;
2431 }
2432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2433         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2434         CResult_PublicKeyNoneZ_get_err(owner_conv);
2435 }
2436
2437 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2438 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2439 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2440 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2442         LDKCOption_BigEndianScalarZ_Some_class =
2443                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2444         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2445         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2446         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2447         LDKCOption_BigEndianScalarZ_None_class =
2448                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2449         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2450         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2451         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2452 }
2453 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2454         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2455         switch(obj->tag) {
2456                 case LDKCOption_BigEndianScalarZ_Some: {
2457                         LDKBigEndianScalar* some_ref = &obj->some;
2458                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2459                 }
2460                 case LDKCOption_BigEndianScalarZ_None: {
2461                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2462                 }
2463                 default: abort();
2464         }
2465 }
2466 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2467 CHECK(owner->result_ok);
2468         return *owner->contents.result;
2469 }
2470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2471         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2472         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2473         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2474         return ret_arr;
2475 }
2476
2477 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2478 CHECK(!owner->result_ok);
2479         return *owner->contents.err;
2480 }
2481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2482         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2483         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2484 }
2485
2486 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2487 CHECK(owner->result_ok);
2488         return *owner->contents.result;
2489 }
2490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2491         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2492         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2493         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2494         return ret_arr;
2495 }
2496
2497 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2498 CHECK(!owner->result_ok);
2499         return *owner->contents.err;
2500 }
2501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2502         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2503         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2504 }
2505
2506 typedef struct LDKChannelSigner_JCalls {
2507         atomic_size_t refcnt;
2508         JavaVM *vm;
2509         jweak o;
2510         jmethodID get_per_commitment_point_meth;
2511         jmethodID release_commitment_secret_meth;
2512         jmethodID validate_holder_commitment_meth;
2513         jmethodID channel_keys_id_meth;
2514         jmethodID provide_channel_parameters_meth;
2515 } LDKChannelSigner_JCalls;
2516 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2517         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2518         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2519                 JNIEnv *env;
2520                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2521                 if (get_jenv_res == JNI_EDETACHED) {
2522                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2523                 } else {
2524                         DO_ASSERT(get_jenv_res == JNI_OK);
2525                 }
2526                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2527                 if (get_jenv_res == JNI_EDETACHED) {
2528                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2529                 }
2530                 FREE(j_calls);
2531         }
2532 }
2533 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2534         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2535         JNIEnv *env;
2536         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2537         if (get_jenv_res == JNI_EDETACHED) {
2538                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2539         } else {
2540                 DO_ASSERT(get_jenv_res == JNI_OK);
2541         }
2542         int64_t idx_conv = idx;
2543         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2544         CHECK(obj != NULL);
2545         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2546         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2547                 (*env)->ExceptionDescribe(env);
2548                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2549         }
2550         LDKPublicKey ret_ref;
2551         CHECK((*env)->GetArrayLength(env, ret) == 33);
2552         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2553         if (get_jenv_res == JNI_EDETACHED) {
2554                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2555         }
2556         return ret_ref;
2557 }
2558 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2559         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2560         JNIEnv *env;
2561         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2562         if (get_jenv_res == JNI_EDETACHED) {
2563                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2564         } else {
2565                 DO_ASSERT(get_jenv_res == JNI_OK);
2566         }
2567         int64_t idx_conv = idx;
2568         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2569         CHECK(obj != NULL);
2570         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2571         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2572                 (*env)->ExceptionDescribe(env);
2573                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2574         }
2575         LDKThirtyTwoBytes ret_ref;
2576         CHECK((*env)->GetArrayLength(env, ret) == 32);
2577         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2578         if (get_jenv_res == JNI_EDETACHED) {
2579                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2580         }
2581         return ret_ref;
2582 }
2583 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2584         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2585         JNIEnv *env;
2586         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2587         if (get_jenv_res == JNI_EDETACHED) {
2588                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2589         } else {
2590                 DO_ASSERT(get_jenv_res == JNI_OK);
2591         }
2592         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2593         int64_t holder_tx_ref = 0;
2594         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2595         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2596         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2597         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2598         jobjectArray preimages_arr = NULL;
2599         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2600         ;
2601         for (size_t i = 0; i < preimages_var.datalen; i++) {
2602                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2603                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2604                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2605         }
2606         
2607         FREE(preimages_var.data);
2608         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2609         CHECK(obj != NULL);
2610         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
2611         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2612                 (*env)->ExceptionDescribe(env);
2613                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2614         }
2615         void* ret_ptr = untag_ptr(ret);
2616         CHECK_ACCESS(ret_ptr);
2617         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2618         FREE(untag_ptr(ret));
2619         if (get_jenv_res == JNI_EDETACHED) {
2620                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2621         }
2622         return ret_conv;
2623 }
2624 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2625         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2626         JNIEnv *env;
2627         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2628         if (get_jenv_res == JNI_EDETACHED) {
2629                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2630         } else {
2631                 DO_ASSERT(get_jenv_res == JNI_OK);
2632         }
2633         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2634         CHECK(obj != NULL);
2635         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2636         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2637                 (*env)->ExceptionDescribe(env);
2638                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2639         }
2640         LDKThirtyTwoBytes ret_ref;
2641         CHECK((*env)->GetArrayLength(env, ret) == 32);
2642         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2643         if (get_jenv_res == JNI_EDETACHED) {
2644                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2645         }
2646         return ret_ref;
2647 }
2648 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2649         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2650         JNIEnv *env;
2651         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2652         if (get_jenv_res == JNI_EDETACHED) {
2653                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2654         } else {
2655                 DO_ASSERT(get_jenv_res == JNI_OK);
2656         }
2657         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2658         int64_t channel_parameters_ref = 0;
2659         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2660         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2661         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2662         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2663         CHECK(obj != NULL);
2664         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2665         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2666                 (*env)->ExceptionDescribe(env);
2667                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2668         }
2669         if (get_jenv_res == JNI_EDETACHED) {
2670                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2671         }
2672 }
2673 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2674         jclass c = (*env)->GetObjectClass(env, o);
2675         CHECK(c != NULL);
2676         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2677         atomic_init(&calls->refcnt, 1);
2678         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2679         calls->o = (*env)->NewWeakGlobalRef(env, o);
2680         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2681         CHECK(calls->get_per_commitment_point_meth != NULL);
2682         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2683         CHECK(calls->release_commitment_secret_meth != NULL);
2684         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2685         CHECK(calls->validate_holder_commitment_meth != NULL);
2686         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2687         CHECK(calls->channel_keys_id_meth != NULL);
2688         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2689         CHECK(calls->provide_channel_parameters_meth != NULL);
2690
2691         LDKChannelPublicKeys pubkeys_conv;
2692         pubkeys_conv.inner = untag_ptr(pubkeys);
2693         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2694         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2695
2696         LDKChannelSigner ret = {
2697                 .this_arg = (void*) calls,
2698                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2699                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2700                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2701                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2702                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2703                 .free = LDKChannelSigner_JCalls_free,
2704                 .pubkeys = pubkeys_conv,
2705                 .set_pubkeys = NULL,
2706         };
2707         return ret;
2708 }
2709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2710         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2711         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2712         return tag_ptr(res_ptr, true);
2713 }
2714 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) {
2715         void* this_arg_ptr = untag_ptr(this_arg);
2716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2717         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2718         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2719         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2720         return ret_arr;
2721 }
2722
2723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2724         void* this_arg_ptr = untag_ptr(this_arg);
2725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2726         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2727         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2728         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2729         return ret_arr;
2730 }
2731
2732 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 preimages) {
2733         void* this_arg_ptr = untag_ptr(this_arg);
2734         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2735         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2736         LDKHolderCommitmentTransaction holder_tx_conv;
2737         holder_tx_conv.inner = untag_ptr(holder_tx);
2738         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2739         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2740         holder_tx_conv.is_owned = false;
2741         LDKCVec_ThirtyTwoBytesZ preimages_constr;
2742         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2743         if (preimages_constr.datalen > 0)
2744                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2745         else
2746                 preimages_constr.data = NULL;
2747         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2748                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2749                 LDKThirtyTwoBytes preimages_conv_8_ref;
2750                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2751                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2752                 preimages_constr.data[i] = preimages_conv_8_ref;
2753         }
2754         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2755         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
2756         return tag_ptr(ret_conv, true);
2757 }
2758
2759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2760         void* this_arg_ptr = untag_ptr(this_arg);
2761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2762         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2763         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2764         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2765         return ret_arr;
2766 }
2767
2768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2769         void* this_arg_ptr = untag_ptr(this_arg);
2770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2771         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2772         LDKChannelTransactionParameters channel_parameters_conv;
2773         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2774         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2775         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2776         channel_parameters_conv.is_owned = false;
2777         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2778 }
2779
2780 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2781         if (this_arg->set_pubkeys != NULL)
2782                 this_arg->set_pubkeys(this_arg);
2783         return this_arg->pubkeys;
2784 }
2785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2786         void* this_arg_ptr = untag_ptr(this_arg);
2787         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2788         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2789         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2790         int64_t ret_ref = 0;
2791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2793         return ret_ref;
2794 }
2795
2796 typedef struct LDKEcdsaChannelSigner_JCalls {
2797         atomic_size_t refcnt;
2798         JavaVM *vm;
2799         jweak o;
2800         LDKChannelSigner_JCalls* ChannelSigner;
2801         jmethodID sign_counterparty_commitment_meth;
2802         jmethodID validate_counterparty_revocation_meth;
2803         jmethodID sign_holder_commitment_and_htlcs_meth;
2804         jmethodID sign_justice_revoked_output_meth;
2805         jmethodID sign_justice_revoked_htlc_meth;
2806         jmethodID sign_holder_htlc_transaction_meth;
2807         jmethodID sign_counterparty_htlc_transaction_meth;
2808         jmethodID sign_closing_transaction_meth;
2809         jmethodID sign_holder_anchor_input_meth;
2810         jmethodID sign_channel_announcement_with_funding_key_meth;
2811 } LDKEcdsaChannelSigner_JCalls;
2812 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2813         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2814         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2815                 JNIEnv *env;
2816                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2817                 if (get_jenv_res == JNI_EDETACHED) {
2818                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2819                 } else {
2820                         DO_ASSERT(get_jenv_res == JNI_OK);
2821                 }
2822                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2823                 if (get_jenv_res == JNI_EDETACHED) {
2824                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2825                 }
2826                 FREE(j_calls);
2827         }
2828 }
2829 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2830         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2831         JNIEnv *env;
2832         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2833         if (get_jenv_res == JNI_EDETACHED) {
2834                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2835         } else {
2836                 DO_ASSERT(get_jenv_res == JNI_OK);
2837         }
2838         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2839         int64_t commitment_tx_ref = 0;
2840         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2841         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2842         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2843         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2844         jobjectArray preimages_arr = NULL;
2845         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2846         ;
2847         for (size_t i = 0; i < preimages_var.datalen; i++) {
2848                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2849                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2850                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2851         }
2852         
2853         FREE(preimages_var.data);
2854         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2855         CHECK(obj != NULL);
2856         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
2857         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2858                 (*env)->ExceptionDescribe(env);
2859                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2860         }
2861         void* ret_ptr = untag_ptr(ret);
2862         CHECK_ACCESS(ret_ptr);
2863         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2864         FREE(untag_ptr(ret));
2865         if (get_jenv_res == JNI_EDETACHED) {
2866                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2867         }
2868         return ret_conv;
2869 }
2870 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2871         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2872         JNIEnv *env;
2873         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2874         if (get_jenv_res == JNI_EDETACHED) {
2875                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2876         } else {
2877                 DO_ASSERT(get_jenv_res == JNI_OK);
2878         }
2879         int64_t idx_conv = idx;
2880         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2881         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2882         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2883         CHECK(obj != NULL);
2884         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2885         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2886                 (*env)->ExceptionDescribe(env);
2887                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
2888         }
2889         void* ret_ptr = untag_ptr(ret);
2890         CHECK_ACCESS(ret_ptr);
2891         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2892         FREE(untag_ptr(ret));
2893         if (get_jenv_res == JNI_EDETACHED) {
2894                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2895         }
2896         return ret_conv;
2897 }
2898 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2899         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2900         JNIEnv *env;
2901         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2902         if (get_jenv_res == JNI_EDETACHED) {
2903                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2904         } else {
2905                 DO_ASSERT(get_jenv_res == JNI_OK);
2906         }
2907         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2908         int64_t commitment_tx_ref = 0;
2909         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2910         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2911         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2912         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2913         CHECK(obj != NULL);
2914         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2915         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2916                 (*env)->ExceptionDescribe(env);
2917                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception.");
2918         }
2919         void* ret_ptr = untag_ptr(ret);
2920         CHECK_ACCESS(ret_ptr);
2921         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2922         FREE(untag_ptr(ret));
2923         if (get_jenv_res == JNI_EDETACHED) {
2924                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2925         }
2926         return ret_conv;
2927 }
2928 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]) {
2929         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2930         JNIEnv *env;
2931         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2932         if (get_jenv_res == JNI_EDETACHED) {
2933                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2934         } else {
2935                 DO_ASSERT(get_jenv_res == JNI_OK);
2936         }
2937         LDKTransaction justice_tx_var = justice_tx;
2938         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2939         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2940         Transaction_free(justice_tx_var);
2941         int64_t input_conv = input;
2942         int64_t amount_conv = amount;
2943         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2944         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2945         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2946         CHECK(obj != NULL);
2947         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);
2948         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2949                 (*env)->ExceptionDescribe(env);
2950                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
2951         }
2952         void* ret_ptr = untag_ptr(ret);
2953         CHECK_ACCESS(ret_ptr);
2954         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2955         FREE(untag_ptr(ret));
2956         if (get_jenv_res == JNI_EDETACHED) {
2957                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2958         }
2959         return ret_conv;
2960 }
2961 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) {
2962         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2963         JNIEnv *env;
2964         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2965         if (get_jenv_res == JNI_EDETACHED) {
2966                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2967         } else {
2968                 DO_ASSERT(get_jenv_res == JNI_OK);
2969         }
2970         LDKTransaction justice_tx_var = justice_tx;
2971         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2972         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2973         Transaction_free(justice_tx_var);
2974         int64_t input_conv = input;
2975         int64_t amount_conv = amount;
2976         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2977         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2978         LDKHTLCOutputInCommitment htlc_var = *htlc;
2979         int64_t htlc_ref = 0;
2980         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2981         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2982         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2983         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2984         CHECK(obj != NULL);
2985         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);
2986         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2987                 (*env)->ExceptionDescribe(env);
2988                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
2989         }
2990         void* ret_ptr = untag_ptr(ret);
2991         CHECK_ACCESS(ret_ptr);
2992         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2993         FREE(untag_ptr(ret));
2994         if (get_jenv_res == JNI_EDETACHED) {
2995                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2996         }
2997         return ret_conv;
2998 }
2999 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3000         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3001         JNIEnv *env;
3002         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3003         if (get_jenv_res == JNI_EDETACHED) {
3004                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3005         } else {
3006                 DO_ASSERT(get_jenv_res == JNI_OK);
3007         }
3008         LDKTransaction htlc_tx_var = htlc_tx;
3009         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3010         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3011         Transaction_free(htlc_tx_var);
3012         int64_t input_conv = input;
3013         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3014         int64_t htlc_descriptor_ref = 0;
3015         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3016         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3017         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3018         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3019         CHECK(obj != NULL);
3020         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3021         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3022                 (*env)->ExceptionDescribe(env);
3023                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3024         }
3025         void* ret_ptr = untag_ptr(ret);
3026         CHECK_ACCESS(ret_ptr);
3027         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3028         FREE(untag_ptr(ret));
3029         if (get_jenv_res == JNI_EDETACHED) {
3030                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3031         }
3032         return ret_conv;
3033 }
3034 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) {
3035         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3036         JNIEnv *env;
3037         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3038         if (get_jenv_res == JNI_EDETACHED) {
3039                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3040         } else {
3041                 DO_ASSERT(get_jenv_res == JNI_OK);
3042         }
3043         LDKTransaction htlc_tx_var = htlc_tx;
3044         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3045         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3046         Transaction_free(htlc_tx_var);
3047         int64_t input_conv = input;
3048         int64_t amount_conv = amount;
3049         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3050         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3051         LDKHTLCOutputInCommitment htlc_var = *htlc;
3052         int64_t htlc_ref = 0;
3053         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3054         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3055         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3056         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3057         CHECK(obj != NULL);
3058         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);
3059         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3060                 (*env)->ExceptionDescribe(env);
3061                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3062         }
3063         void* ret_ptr = untag_ptr(ret);
3064         CHECK_ACCESS(ret_ptr);
3065         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3066         FREE(untag_ptr(ret));
3067         if (get_jenv_res == JNI_EDETACHED) {
3068                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3069         }
3070         return ret_conv;
3071 }
3072 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3073         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3074         JNIEnv *env;
3075         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3076         if (get_jenv_res == JNI_EDETACHED) {
3077                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3078         } else {
3079                 DO_ASSERT(get_jenv_res == JNI_OK);
3080         }
3081         LDKClosingTransaction closing_tx_var = *closing_tx;
3082         int64_t closing_tx_ref = 0;
3083         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3084         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3085         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3086         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3087         CHECK(obj != NULL);
3088         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3089         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3090                 (*env)->ExceptionDescribe(env);
3091                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3092         }
3093         void* ret_ptr = untag_ptr(ret);
3094         CHECK_ACCESS(ret_ptr);
3095         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3096         FREE(untag_ptr(ret));
3097         if (get_jenv_res == JNI_EDETACHED) {
3098                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3099         }
3100         return ret_conv;
3101 }
3102 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3103         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3104         JNIEnv *env;
3105         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3106         if (get_jenv_res == JNI_EDETACHED) {
3107                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3108         } else {
3109                 DO_ASSERT(get_jenv_res == JNI_OK);
3110         }
3111         LDKTransaction anchor_tx_var = anchor_tx;
3112         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3113         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3114         Transaction_free(anchor_tx_var);
3115         int64_t input_conv = input;
3116         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3117         CHECK(obj != NULL);
3118         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3119         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3120                 (*env)->ExceptionDescribe(env);
3121                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3122         }
3123         void* ret_ptr = untag_ptr(ret);
3124         CHECK_ACCESS(ret_ptr);
3125         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3126         FREE(untag_ptr(ret));
3127         if (get_jenv_res == JNI_EDETACHED) {
3128                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3129         }
3130         return ret_conv;
3131 }
3132 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3133         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3134         JNIEnv *env;
3135         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3136         if (get_jenv_res == JNI_EDETACHED) {
3137                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3138         } else {
3139                 DO_ASSERT(get_jenv_res == JNI_OK);
3140         }
3141         LDKUnsignedChannelAnnouncement msg_var = *msg;
3142         int64_t msg_ref = 0;
3143         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3144         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3145         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3146         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3147         CHECK(obj != NULL);
3148         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3149         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3150                 (*env)->ExceptionDescribe(env);
3151                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3152         }
3153         void* ret_ptr = untag_ptr(ret);
3154         CHECK_ACCESS(ret_ptr);
3155         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3156         FREE(untag_ptr(ret));
3157         if (get_jenv_res == JNI_EDETACHED) {
3158                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3159         }
3160         return ret_conv;
3161 }
3162 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3163         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3164         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3165         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3166 }
3167 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3168         jclass c = (*env)->GetObjectClass(env, o);
3169         CHECK(c != NULL);
3170         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3171         atomic_init(&calls->refcnt, 1);
3172         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3173         calls->o = (*env)->NewWeakGlobalRef(env, o);
3174         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
3175         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3176         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3177         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3178         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
3179         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
3180         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3181         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3182         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3183         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3184         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3185         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3186         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3187         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3188         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3189         CHECK(calls->sign_closing_transaction_meth != NULL);
3190         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3191         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3192         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3193         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3194
3195         LDKChannelPublicKeys pubkeys_conv;
3196         pubkeys_conv.inner = untag_ptr(pubkeys);
3197         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3198         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3199
3200         LDKEcdsaChannelSigner ret = {
3201                 .this_arg = (void*) calls,
3202                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3203                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
3204                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
3205                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3206                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3207                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3208                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3209                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3210                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3211                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3212                 .free = LDKEcdsaChannelSigner_JCalls_free,
3213                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3214         };
3215         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3216         return ret;
3217 }
3218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3219         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3220         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3221         return tag_ptr(res_ptr, true);
3222 }
3223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3224         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3225         return tag_ptr(&inp->ChannelSigner, false);
3226 }
3227 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 preimages) {
3228         void* this_arg_ptr = untag_ptr(this_arg);
3229         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3230         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3231         LDKCommitmentTransaction commitment_tx_conv;
3232         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3233         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3234         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3235         commitment_tx_conv.is_owned = false;
3236         LDKCVec_ThirtyTwoBytesZ preimages_constr;
3237         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
3238         if (preimages_constr.datalen > 0)
3239                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3240         else
3241                 preimages_constr.data = NULL;
3242         for (size_t i = 0; i < preimages_constr.datalen; i++) {
3243                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
3244                 LDKThirtyTwoBytes preimages_conv_8_ref;
3245                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
3246                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
3247                 preimages_constr.data[i] = preimages_conv_8_ref;
3248         }
3249         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3250         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3251         return tag_ptr(ret_conv, true);
3252 }
3253
3254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3255         void* this_arg_ptr = untag_ptr(this_arg);
3256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3257         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3258         uint8_t secret_arr[32];
3259         CHECK((*env)->GetArrayLength(env, secret) == 32);
3260         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3261         uint8_t (*secret_ref)[32] = &secret_arr;
3262         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3263         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3264         return tag_ptr(ret_conv, true);
3265 }
3266
3267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
3268         void* this_arg_ptr = untag_ptr(this_arg);
3269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3270         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3271         LDKHolderCommitmentTransaction commitment_tx_conv;
3272         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3273         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3274         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3275         commitment_tx_conv.is_owned = false;
3276         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3277         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3278         return tag_ptr(ret_conv, true);
3279 }
3280
3281 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) {
3282         void* this_arg_ptr = untag_ptr(this_arg);
3283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3284         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3285         LDKTransaction justice_tx_ref;
3286         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3287         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3288         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3289         justice_tx_ref.data_is_owned = true;
3290         uint8_t per_commitment_key_arr[32];
3291         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3292         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3293         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3294         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3295         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3296         return tag_ptr(ret_conv, true);
3297 }
3298
3299 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) {
3300         void* this_arg_ptr = untag_ptr(this_arg);
3301         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3302         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3303         LDKTransaction justice_tx_ref;
3304         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3305         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3306         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3307         justice_tx_ref.data_is_owned = true;
3308         uint8_t per_commitment_key_arr[32];
3309         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3310         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3311         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3312         LDKHTLCOutputInCommitment htlc_conv;
3313         htlc_conv.inner = untag_ptr(htlc);
3314         htlc_conv.is_owned = ptr_is_owned(htlc);
3315         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3316         htlc_conv.is_owned = false;
3317         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3318         *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);
3319         return tag_ptr(ret_conv, true);
3320 }
3321
3322 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) {
3323         void* this_arg_ptr = untag_ptr(this_arg);
3324         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3325         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3326         LDKTransaction htlc_tx_ref;
3327         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3328         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3329         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3330         htlc_tx_ref.data_is_owned = true;
3331         LDKHTLCDescriptor htlc_descriptor_conv;
3332         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3333         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3334         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3335         htlc_descriptor_conv.is_owned = false;
3336         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3337         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3338         return tag_ptr(ret_conv, true);
3339 }
3340
3341 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) {
3342         void* this_arg_ptr = untag_ptr(this_arg);
3343         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3344         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3345         LDKTransaction htlc_tx_ref;
3346         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3347         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3348         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3349         htlc_tx_ref.data_is_owned = true;
3350         LDKPublicKey per_commitment_point_ref;
3351         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3352         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3353         LDKHTLCOutputInCommitment htlc_conv;
3354         htlc_conv.inner = untag_ptr(htlc);
3355         htlc_conv.is_owned = ptr_is_owned(htlc);
3356         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3357         htlc_conv.is_owned = false;
3358         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3359         *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);
3360         return tag_ptr(ret_conv, true);
3361 }
3362
3363 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) {
3364         void* this_arg_ptr = untag_ptr(this_arg);
3365         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3366         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3367         LDKClosingTransaction closing_tx_conv;
3368         closing_tx_conv.inner = untag_ptr(closing_tx);
3369         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3370         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3371         closing_tx_conv.is_owned = false;
3372         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3373         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3374         return tag_ptr(ret_conv, true);
3375 }
3376
3377 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) {
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 anchor_tx_ref;
3382         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3383         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3384         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3385         anchor_tx_ref.data_is_owned = true;
3386         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3387         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3388         return tag_ptr(ret_conv, true);
3389 }
3390
3391 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) {
3392         void* this_arg_ptr = untag_ptr(this_arg);
3393         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3394         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3395         LDKUnsignedChannelAnnouncement msg_conv;
3396         msg_conv.inner = untag_ptr(msg);
3397         msg_conv.is_owned = ptr_is_owned(msg);
3398         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3399         msg_conv.is_owned = false;
3400         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3401         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3402         return tag_ptr(ret_conv, true);
3403 }
3404
3405 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3406         atomic_size_t refcnt;
3407         JavaVM *vm;
3408         jweak o;
3409         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3410         LDKChannelSigner_JCalls* ChannelSigner;
3411         jmethodID write_meth;
3412 } LDKWriteableEcdsaChannelSigner_JCalls;
3413 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3414         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3415         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3416                 JNIEnv *env;
3417                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3418                 if (get_jenv_res == JNI_EDETACHED) {
3419                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3420                 } else {
3421                         DO_ASSERT(get_jenv_res == JNI_OK);
3422                 }
3423                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3424                 if (get_jenv_res == JNI_EDETACHED) {
3425                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3426                 }
3427                 FREE(j_calls);
3428         }
3429 }
3430 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3431         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3432         JNIEnv *env;
3433         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3434         if (get_jenv_res == JNI_EDETACHED) {
3435                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3436         } else {
3437                 DO_ASSERT(get_jenv_res == JNI_OK);
3438         }
3439         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3440         CHECK(obj != NULL);
3441         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3442         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3443                 (*env)->ExceptionDescribe(env);
3444                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3445         }
3446         LDKCVec_u8Z ret_ref;
3447         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3448         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3449         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3450         if (get_jenv_res == JNI_EDETACHED) {
3451                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3452         }
3453         return ret_ref;
3454 }
3455 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3456         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3457         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3458         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3459         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3460 }
3461 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3462         jclass c = (*env)->GetObjectClass(env, o);
3463         CHECK(c != NULL);
3464         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3465         atomic_init(&calls->refcnt, 1);
3466         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3467         calls->o = (*env)->NewWeakGlobalRef(env, o);
3468         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3469         CHECK(calls->write_meth != NULL);
3470
3471         LDKChannelPublicKeys pubkeys_conv;
3472         pubkeys_conv.inner = untag_ptr(pubkeys);
3473         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3474         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3475
3476         LDKWriteableEcdsaChannelSigner ret = {
3477                 .this_arg = (void*) calls,
3478                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3479                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3480                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3481                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3482         };
3483         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3484         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3485         return ret;
3486 }
3487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3488         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3489         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3490         return tag_ptr(res_ptr, true);
3491 }
3492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3493         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3494         return tag_ptr(&inp->EcdsaChannelSigner, false);
3495 }
3496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3497         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3498         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3499 }
3500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3501         void* this_arg_ptr = untag_ptr(this_arg);
3502         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3503         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3504         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3505         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3506         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3507         CVec_u8Z_free(ret_var);
3508         return ret_arr;
3509 }
3510
3511 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3512 CHECK(owner->result_ok);
3513         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3514 }
3515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3516         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3517         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3518         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3519         return tag_ptr(ret_ret, true);
3520 }
3521
3522 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3523 CHECK(!owner->result_ok);
3524         return DecodeError_clone(&*owner->contents.err);
3525 }
3526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3527         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3529         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3530         int64_t ret_ref = tag_ptr(ret_copy, true);
3531         return ret_ref;
3532 }
3533
3534 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3535 CHECK(owner->result_ok);
3536         return CVec_u8Z_clone(&*owner->contents.result);
3537 }
3538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3539         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3540         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3541         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3542         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3543         CVec_u8Z_free(ret_var);
3544         return ret_arr;
3545 }
3546
3547 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3548 CHECK(!owner->result_ok);
3549         return *owner->contents.err;
3550 }
3551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3552         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3553         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3554 }
3555
3556 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3557         LDKShutdownScript ret = *owner->contents.result;
3558         ret.is_owned = false;
3559         return ret;
3560 }
3561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3562         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3563         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3564         int64_t ret_ref = 0;
3565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3567         return ret_ref;
3568 }
3569
3570 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3571 CHECK(!owner->result_ok);
3572         return *owner->contents.err;
3573 }
3574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3575         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3576         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3577 }
3578
3579 static jclass LDKCOption_u16Z_Some_class = NULL;
3580 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3581 static jclass LDKCOption_u16Z_None_class = NULL;
3582 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3584         LDKCOption_u16Z_Some_class =
3585                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3586         CHECK(LDKCOption_u16Z_Some_class != NULL);
3587         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3588         CHECK(LDKCOption_u16Z_Some_meth != NULL);
3589         LDKCOption_u16Z_None_class =
3590                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3591         CHECK(LDKCOption_u16Z_None_class != NULL);
3592         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3593         CHECK(LDKCOption_u16Z_None_meth != NULL);
3594 }
3595 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3596         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
3597         switch(obj->tag) {
3598                 case LDKCOption_u16Z_Some: {
3599                         int16_t some_conv = obj->some;
3600                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
3601                 }
3602                 case LDKCOption_u16Z_None: {
3603                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3604                 }
3605                 default: abort();
3606         }
3607 }
3608 static jclass LDKCOption_boolZ_Some_class = NULL;
3609 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
3610 static jclass LDKCOption_boolZ_None_class = NULL;
3611 static jmethodID LDKCOption_boolZ_None_meth = NULL;
3612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
3613         LDKCOption_boolZ_Some_class =
3614                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
3615         CHECK(LDKCOption_boolZ_Some_class != NULL);
3616         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
3617         CHECK(LDKCOption_boolZ_Some_meth != NULL);
3618         LDKCOption_boolZ_None_class =
3619                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
3620         CHECK(LDKCOption_boolZ_None_class != NULL);
3621         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
3622         CHECK(LDKCOption_boolZ_None_meth != NULL);
3623 }
3624 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3625         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
3626         switch(obj->tag) {
3627                 case LDKCOption_boolZ_Some: {
3628                         jboolean some_conv = obj->some;
3629                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
3630                 }
3631                 case LDKCOption_boolZ_None: {
3632                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
3633                 }
3634                 default: abort();
3635         }
3636 }
3637 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3638         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3639         for (size_t i = 0; i < ret.datalen; i++) {
3640                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3641         }
3642         return ret;
3643 }
3644 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3645 CHECK(owner->result_ok);
3646         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3647 }
3648 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3649         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3650         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3651         jobjectArray ret_arr = NULL;
3652         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3653         ;
3654         for (size_t i = 0; i < ret_var.datalen; i++) {
3655                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
3656                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
3657                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
3658                 CVec_u8Z_free(ret_conv_8_var);
3659                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3660         }
3661         
3662         FREE(ret_var.data);
3663         return ret_arr;
3664 }
3665
3666 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3667 CHECK(!owner->result_ok);
3668         return *owner->contents.err;
3669 }
3670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3671         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3672         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3673 }
3674
3675 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3676         LDKInMemorySigner ret = *owner->contents.result;
3677         ret.is_owned = false;
3678         return ret;
3679 }
3680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3681         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3682         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3683         int64_t ret_ref = 0;
3684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3686         return ret_ref;
3687 }
3688
3689 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3690 CHECK(!owner->result_ok);
3691         return DecodeError_clone(&*owner->contents.err);
3692 }
3693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3694         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3695         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3696         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3697         int64_t ret_ref = tag_ptr(ret_copy, true);
3698         return ret_ref;
3699 }
3700
3701 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3702 CHECK(owner->result_ok);
3703         return *owner->contents.result;
3704 }
3705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3706         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3707         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3708         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3709         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3710         return ret_arr;
3711 }
3712
3713 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3714 CHECK(!owner->result_ok);
3715         return *owner->contents.err;
3716 }
3717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3718         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3719         CResult_TransactionNoneZ_get_err(owner_conv);
3720 }
3721
3722 typedef struct LDKScoreLookUp_JCalls {
3723         atomic_size_t refcnt;
3724         JavaVM *vm;
3725         jweak o;
3726         jmethodID channel_penalty_msat_meth;
3727 } LDKScoreLookUp_JCalls;
3728 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
3729         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3730         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3731                 JNIEnv *env;
3732                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3733                 if (get_jenv_res == JNI_EDETACHED) {
3734                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3735                 } else {
3736                         DO_ASSERT(get_jenv_res == JNI_OK);
3737                 }
3738                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3739                 if (get_jenv_res == JNI_EDETACHED) {
3740                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3741                 }
3742                 FREE(j_calls);
3743         }
3744 }
3745 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
3746         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3747         JNIEnv *env;
3748         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3749         if (get_jenv_res == JNI_EDETACHED) {
3750                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3751         } else {
3752                 DO_ASSERT(get_jenv_res == JNI_OK);
3753         }
3754         int64_t short_channel_id_conv = short_channel_id;
3755         LDKNodeId source_var = *source;
3756         int64_t source_ref = 0;
3757         source_var = NodeId_clone(&source_var);
3758         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
3759         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
3760         LDKNodeId target_var = *target;
3761         int64_t target_ref = 0;
3762         target_var = NodeId_clone(&target_var);
3763         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
3764         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
3765         LDKChannelUsage usage_var = usage;
3766         int64_t usage_ref = 0;
3767         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3768         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3769         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3770         int64_t score_params_ref = 0;
3771         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3772         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3773         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3774         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3775         CHECK(obj != NULL);
3776         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref);
3777         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3778                 (*env)->ExceptionDescribe(env);
3779                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
3780         }
3781         if (get_jenv_res == JNI_EDETACHED) {
3782                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3783         }
3784         return ret;
3785 }
3786 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
3787         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
3788         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3789 }
3790 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
3791         jclass c = (*env)->GetObjectClass(env, o);
3792         CHECK(c != NULL);
3793         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
3794         atomic_init(&calls->refcnt, 1);
3795         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3796         calls->o = (*env)->NewWeakGlobalRef(env, o);
3797         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
3798         CHECK(calls->channel_penalty_msat_meth != NULL);
3799
3800         LDKScoreLookUp ret = {
3801                 .this_arg = (void*) calls,
3802                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
3803                 .free = LDKScoreLookUp_JCalls_free,
3804         };
3805         return ret;
3806 }
3807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
3808         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3809         *res_ptr = LDKScoreLookUp_init(env, clz, o);
3810         return tag_ptr(res_ptr, true);
3811 }
3812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target, int64_t usage, int64_t score_params) {
3813         void* this_arg_ptr = untag_ptr(this_arg);
3814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3815         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
3816         LDKNodeId source_conv;
3817         source_conv.inner = untag_ptr(source);
3818         source_conv.is_owned = ptr_is_owned(source);
3819         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
3820         source_conv.is_owned = false;
3821         LDKNodeId target_conv;
3822         target_conv.inner = untag_ptr(target);
3823         target_conv.is_owned = ptr_is_owned(target);
3824         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
3825         target_conv.is_owned = false;
3826         LDKChannelUsage usage_conv;
3827         usage_conv.inner = untag_ptr(usage);
3828         usage_conv.is_owned = ptr_is_owned(usage);
3829         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3830         usage_conv = ChannelUsage_clone(&usage_conv);
3831         LDKProbabilisticScoringFeeParameters score_params_conv;
3832         score_params_conv.inner = untag_ptr(score_params);
3833         score_params_conv.is_owned = ptr_is_owned(score_params);
3834         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3835         score_params_conv.is_owned = false;
3836         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv, &score_params_conv);
3837         return ret_conv;
3838 }
3839
3840 typedef struct LDKScoreUpdate_JCalls {
3841         atomic_size_t refcnt;
3842         JavaVM *vm;
3843         jweak o;
3844         jmethodID payment_path_failed_meth;
3845         jmethodID payment_path_successful_meth;
3846         jmethodID probe_failed_meth;
3847         jmethodID probe_successful_meth;
3848 } LDKScoreUpdate_JCalls;
3849 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
3850         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3851         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3852                 JNIEnv *env;
3853                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3854                 if (get_jenv_res == JNI_EDETACHED) {
3855                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3856                 } else {
3857                         DO_ASSERT(get_jenv_res == JNI_OK);
3858                 }
3859                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3860                 if (get_jenv_res == JNI_EDETACHED) {
3861                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3862                 }
3863                 FREE(j_calls);
3864         }
3865 }
3866 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3867         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3868         JNIEnv *env;
3869         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3870         if (get_jenv_res == JNI_EDETACHED) {
3871                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3872         } else {
3873                 DO_ASSERT(get_jenv_res == JNI_OK);
3874         }
3875         LDKPath path_var = *path;
3876         int64_t path_ref = 0;
3877         path_var = Path_clone(&path_var);
3878         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3879         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3880         int64_t short_channel_id_conv = short_channel_id;
3881         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3882         CHECK(obj != NULL);
3883         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv);
3884         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3885                 (*env)->ExceptionDescribe(env);
3886                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
3887         }
3888         if (get_jenv_res == JNI_EDETACHED) {
3889                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3890         }
3891 }
3892 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
3893         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3894         JNIEnv *env;
3895         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3896         if (get_jenv_res == JNI_EDETACHED) {
3897                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3898         } else {
3899                 DO_ASSERT(get_jenv_res == JNI_OK);
3900         }
3901         LDKPath path_var = *path;
3902         int64_t path_ref = 0;
3903         path_var = Path_clone(&path_var);
3904         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3905         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3906         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3907         CHECK(obj != NULL);
3908         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref);
3909         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3910                 (*env)->ExceptionDescribe(env);
3911                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate 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 }
3917 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3918         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3919         JNIEnv *env;
3920         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3921         if (get_jenv_res == JNI_EDETACHED) {
3922                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3923         } else {
3924                 DO_ASSERT(get_jenv_res == JNI_OK);
3925         }
3926         LDKPath path_var = *path;
3927         int64_t path_ref = 0;
3928         path_var = Path_clone(&path_var);
3929         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3930         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3931         int64_t short_channel_id_conv = short_channel_id;
3932         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3933         CHECK(obj != NULL);
3934         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv);
3935         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3936                 (*env)->ExceptionDescribe(env);
3937                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
3938         }
3939         if (get_jenv_res == JNI_EDETACHED) {
3940                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3941         }
3942 }
3943 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
3944         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3945         JNIEnv *env;
3946         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3947         if (get_jenv_res == JNI_EDETACHED) {
3948                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3949         } else {
3950                 DO_ASSERT(get_jenv_res == JNI_OK);
3951         }
3952         LDKPath path_var = *path;
3953         int64_t path_ref = 0;
3954         path_var = Path_clone(&path_var);
3955         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3956         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3957         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3958         CHECK(obj != NULL);
3959         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref);
3960         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3961                 (*env)->ExceptionDescribe(env);
3962                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
3963         }
3964         if (get_jenv_res == JNI_EDETACHED) {
3965                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3966         }
3967 }
3968 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
3969         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
3970         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3971 }
3972 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
3973         jclass c = (*env)->GetObjectClass(env, o);
3974         CHECK(c != NULL);
3975         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
3976         atomic_init(&calls->refcnt, 1);
3977         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3978         calls->o = (*env)->NewWeakGlobalRef(env, o);
3979         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJ)V");
3980         CHECK(calls->payment_path_failed_meth != NULL);
3981         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(J)V");
3982         CHECK(calls->payment_path_successful_meth != NULL);
3983         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJ)V");
3984         CHECK(calls->probe_failed_meth != NULL);
3985         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(J)V");
3986         CHECK(calls->probe_successful_meth != NULL);
3987
3988         LDKScoreUpdate ret = {
3989                 .this_arg = (void*) calls,
3990                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
3991                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
3992                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
3993                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
3994                 .free = LDKScoreUpdate_JCalls_free,
3995         };
3996         return ret;
3997 }
3998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
3999         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4000         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4001         return tag_ptr(res_ptr, true);
4002 }
4003 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) {
4004         void* this_arg_ptr = untag_ptr(this_arg);
4005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4006         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4007         LDKPath path_conv;
4008         path_conv.inner = untag_ptr(path);
4009         path_conv.is_owned = ptr_is_owned(path);
4010         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4011         path_conv.is_owned = false;
4012         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4013 }
4014
4015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4016         void* this_arg_ptr = untag_ptr(this_arg);
4017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4018         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4019         LDKPath path_conv;
4020         path_conv.inner = untag_ptr(path);
4021         path_conv.is_owned = ptr_is_owned(path);
4022         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4023         path_conv.is_owned = false;
4024         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
4025 }
4026
4027 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) {
4028         void* this_arg_ptr = untag_ptr(this_arg);
4029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4030         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4031         LDKPath path_conv;
4032         path_conv.inner = untag_ptr(path);
4033         path_conv.is_owned = ptr_is_owned(path);
4034         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4035         path_conv.is_owned = false;
4036         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4037 }
4038
4039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4040         void* this_arg_ptr = untag_ptr(this_arg);
4041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4042         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4043         LDKPath path_conv;
4044         path_conv.inner = untag_ptr(path);
4045         path_conv.is_owned = ptr_is_owned(path);
4046         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4047         path_conv.is_owned = false;
4048         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
4049 }
4050
4051 typedef struct LDKLockableScore_JCalls {
4052         atomic_size_t refcnt;
4053         JavaVM *vm;
4054         jweak o;
4055         jmethodID read_lock_meth;
4056         jmethodID write_lock_meth;
4057 } LDKLockableScore_JCalls;
4058 static void LDKLockableScore_JCalls_free(void* this_arg) {
4059         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4060         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4061                 JNIEnv *env;
4062                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4063                 if (get_jenv_res == JNI_EDETACHED) {
4064                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4065                 } else {
4066                         DO_ASSERT(get_jenv_res == JNI_OK);
4067                 }
4068                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4069                 if (get_jenv_res == JNI_EDETACHED) {
4070                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4071                 }
4072                 FREE(j_calls);
4073         }
4074 }
4075 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4076         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4077         JNIEnv *env;
4078         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4079         if (get_jenv_res == JNI_EDETACHED) {
4080                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4081         } else {
4082                 DO_ASSERT(get_jenv_res == JNI_OK);
4083         }
4084         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4085         CHECK(obj != NULL);
4086         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4087         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4088                 (*env)->ExceptionDescribe(env);
4089                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4090         }
4091         void* ret_ptr = untag_ptr(ret);
4092         CHECK_ACCESS(ret_ptr);
4093         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4094         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4096                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4097         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4098         
4099         if (get_jenv_res == JNI_EDETACHED) {
4100                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4101         }
4102         return ret_conv;
4103 }
4104 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4105         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4106         JNIEnv *env;
4107         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4108         if (get_jenv_res == JNI_EDETACHED) {
4109                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4110         } else {
4111                 DO_ASSERT(get_jenv_res == JNI_OK);
4112         }
4113         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4114         CHECK(obj != NULL);
4115         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4116         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4117                 (*env)->ExceptionDescribe(env);
4118                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4119         }
4120         void* ret_ptr = untag_ptr(ret);
4121         CHECK_ACCESS(ret_ptr);
4122         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4123         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4124                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4125                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4126         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4127         
4128         if (get_jenv_res == JNI_EDETACHED) {
4129                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4130         }
4131         return ret_conv;
4132 }
4133 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4134         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4135         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4136 }
4137 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4138         jclass c = (*env)->GetObjectClass(env, o);
4139         CHECK(c != NULL);
4140         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4141         atomic_init(&calls->refcnt, 1);
4142         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4143         calls->o = (*env)->NewWeakGlobalRef(env, o);
4144         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4145         CHECK(calls->read_lock_meth != NULL);
4146         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4147         CHECK(calls->write_lock_meth != NULL);
4148
4149         LDKLockableScore ret = {
4150                 .this_arg = (void*) calls,
4151                 .read_lock = read_lock_LDKLockableScore_jcall,
4152                 .write_lock = write_lock_LDKLockableScore_jcall,
4153                 .free = LDKLockableScore_JCalls_free,
4154         };
4155         return ret;
4156 }
4157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4158         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4159         *res_ptr = LDKLockableScore_init(env, clz, o);
4160         return tag_ptr(res_ptr, true);
4161 }
4162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4163         void* this_arg_ptr = untag_ptr(this_arg);
4164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4165         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4166         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4167         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4168         return tag_ptr(ret_ret, true);
4169 }
4170
4171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4172         void* this_arg_ptr = untag_ptr(this_arg);
4173         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4174         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4175         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4176         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4177         return tag_ptr(ret_ret, true);
4178 }
4179
4180 typedef struct LDKWriteableScore_JCalls {
4181         atomic_size_t refcnt;
4182         JavaVM *vm;
4183         jweak o;
4184         LDKLockableScore_JCalls* LockableScore;
4185         jmethodID write_meth;
4186 } LDKWriteableScore_JCalls;
4187 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4188         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4189         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4190                 JNIEnv *env;
4191                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4192                 if (get_jenv_res == JNI_EDETACHED) {
4193                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4194                 } else {
4195                         DO_ASSERT(get_jenv_res == JNI_OK);
4196                 }
4197                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4198                 if (get_jenv_res == JNI_EDETACHED) {
4199                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4200                 }
4201                 FREE(j_calls);
4202         }
4203 }
4204 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4205         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4206         JNIEnv *env;
4207         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4208         if (get_jenv_res == JNI_EDETACHED) {
4209                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4210         } else {
4211                 DO_ASSERT(get_jenv_res == JNI_OK);
4212         }
4213         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4214         CHECK(obj != NULL);
4215         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4216         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4217                 (*env)->ExceptionDescribe(env);
4218                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4219         }
4220         LDKCVec_u8Z ret_ref;
4221         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4222         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4223         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4224         if (get_jenv_res == JNI_EDETACHED) {
4225                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4226         }
4227         return ret_ref;
4228 }
4229 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4230         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4231         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4232         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4233 }
4234 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4235         jclass c = (*env)->GetObjectClass(env, o);
4236         CHECK(c != NULL);
4237         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4238         atomic_init(&calls->refcnt, 1);
4239         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4240         calls->o = (*env)->NewWeakGlobalRef(env, o);
4241         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4242         CHECK(calls->write_meth != NULL);
4243
4244         LDKWriteableScore ret = {
4245                 .this_arg = (void*) calls,
4246                 .write = write_LDKWriteableScore_jcall,
4247                 .free = LDKWriteableScore_JCalls_free,
4248                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4249         };
4250         calls->LockableScore = ret.LockableScore.this_arg;
4251         return ret;
4252 }
4253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4254         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4255         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4256         return tag_ptr(res_ptr, true);
4257 }
4258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4259         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4260         return tag_ptr(&inp->LockableScore, false);
4261 }
4262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4263         void* this_arg_ptr = untag_ptr(this_arg);
4264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4265         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4266         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4267         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4268         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4269         CVec_u8Z_free(ret_var);
4270         return ret_arr;
4271 }
4272
4273 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4274 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4275 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4276 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4278         LDKCOption_WriteableScoreZ_Some_class =
4279                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4280         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4281         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4282         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4283         LDKCOption_WriteableScoreZ_None_class =
4284                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4285         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4286         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4287         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4288 }
4289 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4290         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4291         switch(obj->tag) {
4292                 case LDKCOption_WriteableScoreZ_Some: {
4293                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4294                         *some_ret = obj->some;
4295                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4296                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4297                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4298                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4299                         }
4300                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4301                 }
4302                 case LDKCOption_WriteableScoreZ_None: {
4303                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4304                 }
4305                 default: abort();
4306         }
4307 }
4308 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4309 CHECK(owner->result_ok);
4310         return *owner->contents.result;
4311 }
4312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4313         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4314         CResult_NoneIOErrorZ_get_ok(owner_conv);
4315 }
4316
4317 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4318 CHECK(!owner->result_ok);
4319         return *owner->contents.err;
4320 }
4321 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4322         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4323         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4324         return ret_conv;
4325 }
4326
4327 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4328         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4329         for (size_t i = 0; i < ret.datalen; i++) {
4330                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4331         }
4332         return ret;
4333 }
4334 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4335         LDKRoute ret = *owner->contents.result;
4336         ret.is_owned = false;
4337         return ret;
4338 }
4339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4340         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4341         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4342         int64_t ret_ref = 0;
4343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4345         return ret_ref;
4346 }
4347
4348 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4349         LDKLightningError ret = *owner->contents.err;
4350         ret.is_owned = false;
4351         return ret;
4352 }
4353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4354         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4355         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4356         int64_t ret_ref = 0;
4357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4359         return ret_ref;
4360 }
4361
4362 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4363         LDKInFlightHtlcs ret = *owner->contents.result;
4364         ret.is_owned = false;
4365         return ret;
4366 }
4367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4368         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4369         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4370         int64_t ret_ref = 0;
4371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4373         return ret_ref;
4374 }
4375
4376 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4377 CHECK(!owner->result_ok);
4378         return DecodeError_clone(&*owner->contents.err);
4379 }
4380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4381         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4382         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4383         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4384         int64_t ret_ref = tag_ptr(ret_copy, true);
4385         return ret_ref;
4386 }
4387
4388 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4389         LDKRouteHop ret = *owner->contents.result;
4390         ret.is_owned = false;
4391         return ret;
4392 }
4393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4394         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4395         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4396         int64_t ret_ref = 0;
4397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4399         return ret_ref;
4400 }
4401
4402 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4403 CHECK(!owner->result_ok);
4404         return DecodeError_clone(&*owner->contents.err);
4405 }
4406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4407         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4408         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4409         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4410         int64_t ret_ref = tag_ptr(ret_copy, true);
4411         return ret_ref;
4412 }
4413
4414 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4415         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4416         for (size_t i = 0; i < ret.datalen; i++) {
4417                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4418         }
4419         return ret;
4420 }
4421 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4422         LDKBlindedTail ret = *owner->contents.result;
4423         ret.is_owned = false;
4424         return ret;
4425 }
4426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4427         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4428         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4429         int64_t ret_ref = 0;
4430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4432         return ret_ref;
4433 }
4434
4435 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4436 CHECK(!owner->result_ok);
4437         return DecodeError_clone(&*owner->contents.err);
4438 }
4439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4440         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4441         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4442         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4443         int64_t ret_ref = tag_ptr(ret_copy, true);
4444         return ret_ref;
4445 }
4446
4447 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4448         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4449         for (size_t i = 0; i < ret.datalen; i++) {
4450                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4451         }
4452         return ret;
4453 }
4454 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4455         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4456         for (size_t i = 0; i < ret.datalen; i++) {
4457                 ret.data[i] = Path_clone(&orig->data[i]);
4458         }
4459         return ret;
4460 }
4461 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4462         LDKRoute ret = *owner->contents.result;
4463         ret.is_owned = false;
4464         return ret;
4465 }
4466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4467         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4468         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4469         int64_t ret_ref = 0;
4470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4472         return ret_ref;
4473 }
4474
4475 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4476 CHECK(!owner->result_ok);
4477         return DecodeError_clone(&*owner->contents.err);
4478 }
4479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4480         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4481         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4482         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4483         int64_t ret_ref = tag_ptr(ret_copy, true);
4484         return ret_ref;
4485 }
4486
4487 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4488         LDKRouteParameters ret = *owner->contents.result;
4489         ret.is_owned = false;
4490         return ret;
4491 }
4492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4493         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4494         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4495         int64_t ret_ref = 0;
4496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4498         return ret_ref;
4499 }
4500
4501 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4502 CHECK(!owner->result_ok);
4503         return DecodeError_clone(&*owner->contents.err);
4504 }
4505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4506         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4507         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4508         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4509         int64_t ret_ref = tag_ptr(ret_copy, true);
4510         return ret_ref;
4511 }
4512
4513 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4514         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4515         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4516         return ret;
4517 }
4518 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4519         LDKPaymentParameters ret = *owner->contents.result;
4520         ret.is_owned = false;
4521         return ret;
4522 }
4523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4524         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4525         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4526         int64_t ret_ref = 0;
4527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4529         return ret_ref;
4530 }
4531
4532 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4533 CHECK(!owner->result_ok);
4534         return DecodeError_clone(&*owner->contents.err);
4535 }
4536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4537         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4538         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4539         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4540         int64_t ret_ref = tag_ptr(ret_copy, true);
4541         return ret_ref;
4542 }
4543
4544 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4545         LDKBlindedPayInfo ret = owner->a;
4546         ret.is_owned = false;
4547         return ret;
4548 }
4549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4550         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4551         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4552         int64_t ret_ref = 0;
4553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4555         return ret_ref;
4556 }
4557
4558 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4559         LDKBlindedPath ret = owner->b;
4560         ret.is_owned = false;
4561         return ret;
4562 }
4563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4564         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4565         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4566         int64_t ret_ref = 0;
4567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4569         return ret_ref;
4570 }
4571
4572 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4573         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4574         for (size_t i = 0; i < ret.datalen; i++) {
4575                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4576         }
4577         return ret;
4578 }
4579 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4580         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4581         for (size_t i = 0; i < ret.datalen; i++) {
4582                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4583         }
4584         return ret;
4585 }
4586 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4587         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4588         for (size_t i = 0; i < ret.datalen; i++) {
4589                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4590         }
4591         return ret;
4592 }
4593 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4594         LDKRouteHint ret = *owner->contents.result;
4595         ret.is_owned = false;
4596         return ret;
4597 }
4598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4599         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4600         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4601         int64_t ret_ref = 0;
4602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4604         return ret_ref;
4605 }
4606
4607 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4608 CHECK(!owner->result_ok);
4609         return DecodeError_clone(&*owner->contents.err);
4610 }
4611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4612         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4614         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4615         int64_t ret_ref = tag_ptr(ret_copy, true);
4616         return ret_ref;
4617 }
4618
4619 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4620         LDKRouteHintHop ret = *owner->contents.result;
4621         ret.is_owned = false;
4622         return ret;
4623 }
4624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4625         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4626         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4627         int64_t ret_ref = 0;
4628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4630         return ret_ref;
4631 }
4632
4633 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4634 CHECK(!owner->result_ok);
4635         return DecodeError_clone(&*owner->contents.err);
4636 }
4637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4638         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4640         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4641         int64_t ret_ref = tag_ptr(ret_copy, true);
4642         return ret_ref;
4643 }
4644
4645 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4646         LDKFixedPenaltyScorer ret = *owner->contents.result;
4647         ret.is_owned = false;
4648         return ret;
4649 }
4650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4651         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4652         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4653         int64_t ret_ref = 0;
4654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4656         return ret_ref;
4657 }
4658
4659 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4660 CHECK(!owner->result_ok);
4661         return DecodeError_clone(&*owner->contents.err);
4662 }
4663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4664         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4665         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4666         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4667         int64_t ret_ref = tag_ptr(ret_copy, true);
4668         return ret_ref;
4669 }
4670
4671 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4672         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4673         for (size_t i = 0; i < ret.datalen; i++) {
4674                 ret.data[i] = NodeId_clone(&orig->data[i]);
4675         }
4676         return ret;
4677 }
4678 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4679         return owner->a;
4680 }
4681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4682         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4683         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4684         return ret_conv;
4685 }
4686
4687 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4688         return owner->b;
4689 }
4690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4691         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4692         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4693         return ret_conv;
4694 }
4695
4696 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4697 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4698 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4699 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4701         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4702                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4703         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4704         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4705         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4706         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4707                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4708         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4709         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4710         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4711 }
4712 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4713         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4714         switch(obj->tag) {
4715                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4716                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4717                         *some_conv = obj->some;
4718                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4719                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4720                 }
4721                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4722                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4723                 }
4724                 default: abort();
4725         }
4726 }
4727 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4728         return owner->a;
4729 }
4730 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4731         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4732         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4733         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
4734         return ret_arr;
4735 }
4736
4737 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4738         return owner->b;
4739 }
4740 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4741         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4742         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4743         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
4744         return ret_arr;
4745 }
4746
4747 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4748         return owner->a;
4749 }
4750 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4751         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4752         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4753         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
4754         return ret_arr;
4755 }
4756
4757 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4758         return owner->b;
4759 }
4760 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4761         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4762         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4763         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
4764         return ret_arr;
4765 }
4766
4767 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
4768 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
4769 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
4770 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
4771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
4772         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
4773                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
4774         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
4775         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
4776         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
4777         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
4778                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
4779         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
4780         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
4781         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
4782 }
4783 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4784         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
4785         switch(obj->tag) {
4786                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
4787                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
4788                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
4789                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
4790                 }
4791                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
4792                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
4793                 }
4794                 default: abort();
4795         }
4796 }
4797 static jclass LDKCOption_f64Z_Some_class = NULL;
4798 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
4799 static jclass LDKCOption_f64Z_None_class = NULL;
4800 static jmethodID LDKCOption_f64Z_None_meth = NULL;
4801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
4802         LDKCOption_f64Z_Some_class =
4803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
4804         CHECK(LDKCOption_f64Z_Some_class != NULL);
4805         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
4806         CHECK(LDKCOption_f64Z_Some_meth != NULL);
4807         LDKCOption_f64Z_None_class =
4808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
4809         CHECK(LDKCOption_f64Z_None_class != NULL);
4810         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
4811         CHECK(LDKCOption_f64Z_None_meth != NULL);
4812 }
4813 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4814         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
4815         switch(obj->tag) {
4816                 case LDKCOption_f64Z_Some: {
4817                         double some_conv = obj->some;
4818                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
4819                 }
4820                 case LDKCOption_f64Z_None: {
4821                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
4822                 }
4823                 default: abort();
4824         }
4825 }
4826 typedef struct LDKLogger_JCalls {
4827         atomic_size_t refcnt;
4828         JavaVM *vm;
4829         jweak o;
4830         jmethodID log_meth;
4831 } LDKLogger_JCalls;
4832 static void LDKLogger_JCalls_free(void* this_arg) {
4833         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4834         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4835                 JNIEnv *env;
4836                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4837                 if (get_jenv_res == JNI_EDETACHED) {
4838                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4839                 } else {
4840                         DO_ASSERT(get_jenv_res == JNI_OK);
4841                 }
4842                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4843                 if (get_jenv_res == JNI_EDETACHED) {
4844                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4845                 }
4846                 FREE(j_calls);
4847         }
4848 }
4849 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4850         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4851         JNIEnv *env;
4852         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4853         if (get_jenv_res == JNI_EDETACHED) {
4854                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4855         } else {
4856                 DO_ASSERT(get_jenv_res == JNI_OK);
4857         }
4858         LDKRecord record_var = *record;
4859         int64_t record_ref = 0;
4860         record_var = Record_clone(&record_var);
4861         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4862         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4863         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4864         CHECK(obj != NULL);
4865         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4866         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4867                 (*env)->ExceptionDescribe(env);
4868                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4869         }
4870         if (get_jenv_res == JNI_EDETACHED) {
4871                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4872         }
4873 }
4874 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4875         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4876         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4877 }
4878 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4879         jclass c = (*env)->GetObjectClass(env, o);
4880         CHECK(c != NULL);
4881         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4882         atomic_init(&calls->refcnt, 1);
4883         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4884         calls->o = (*env)->NewWeakGlobalRef(env, o);
4885         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4886         CHECK(calls->log_meth != NULL);
4887
4888         LDKLogger ret = {
4889                 .this_arg = (void*) calls,
4890                 .log = log_LDKLogger_jcall,
4891                 .free = LDKLogger_JCalls_free,
4892         };
4893         return ret;
4894 }
4895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4896         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4897         *res_ptr = LDKLogger_init(env, clz, o);
4898         return tag_ptr(res_ptr, true);
4899 }
4900 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4901         LDKProbabilisticScorer ret = *owner->contents.result;
4902         ret.is_owned = false;
4903         return ret;
4904 }
4905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4906         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4907         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4908         int64_t ret_ref = 0;
4909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4911         return ret_ref;
4912 }
4913
4914 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4915 CHECK(!owner->result_ok);
4916         return DecodeError_clone(&*owner->contents.err);
4917 }
4918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4919         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4920         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4921         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4922         int64_t ret_ref = tag_ptr(ret_copy, true);
4923         return ret_ref;
4924 }
4925
4926 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4927         return owner->a;
4928 }
4929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4930         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4931         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
4932         return ret_conv;
4933 }
4934
4935 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4936         return owner->b;
4937 }
4938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4939         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4940         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
4941         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4942         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4943         return ret_arr;
4944 }
4945
4946 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
4947         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
4948         for (size_t i = 0; i < ret.datalen; i++) {
4949                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
4950         }
4951         return ret;
4952 }
4953 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
4954         return ThirtyTwoBytes_clone(&owner->a);
4955 }
4956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4957         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
4958         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4959         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
4960         return ret_arr;
4961 }
4962
4963 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
4964         return COption_ThirtyTwoBytesZ_clone(&owner->b);
4965 }
4966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4967         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
4968         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
4969         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
4970         int64_t ret_ref = tag_ptr(ret_copy, true);
4971         return ret_ref;
4972 }
4973
4974 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
4975         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
4976         for (size_t i = 0; i < ret.datalen; i++) {
4977                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
4978         }
4979         return ret;
4980 }
4981 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
4982 CHECK(owner->result_ok);
4983         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
4984 }
4985 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4986         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
4987         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
4988         return ret_conv;
4989 }
4990
4991 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
4992 CHECK(!owner->result_ok);
4993         return *owner->contents.err;
4994 }
4995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4996         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
4997         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
4998 }
4999
5000 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5001 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5002 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5003 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5004 static jclass LDKMonitorEvent_Completed_class = NULL;
5005 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5007         LDKMonitorEvent_HTLCEvent_class =
5008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5009         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5010         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5011         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5012         LDKMonitorEvent_HolderForceClosed_class =
5013                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5014         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5015         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5016         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5017         LDKMonitorEvent_Completed_class =
5018                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5019         CHECK(LDKMonitorEvent_Completed_class != NULL);
5020         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
5021         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5022 }
5023 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5024         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5025         switch(obj->tag) {
5026                 case LDKMonitorEvent_HTLCEvent: {
5027                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5028                         int64_t htlc_event_ref = 0;
5029                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5030                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5031                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5032                 }
5033                 case LDKMonitorEvent_HolderForceClosed: {
5034                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5035                         int64_t holder_force_closed_ref = 0;
5036                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5037                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5038                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5039                 }
5040                 case LDKMonitorEvent_Completed: {
5041                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5042                         int64_t funding_txo_ref = 0;
5043                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5044                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5045                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5046                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
5047                 }
5048                 default: abort();
5049         }
5050 }
5051 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5052         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5053         for (size_t i = 0; i < ret.datalen; i++) {
5054                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5055         }
5056         return ret;
5057 }
5058 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5059         LDKOutPoint ret = owner->a;
5060         ret.is_owned = false;
5061         return ret;
5062 }
5063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5064         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5065         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5066         int64_t ret_ref = 0;
5067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5069         return ret_ref;
5070 }
5071
5072 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5073         return CVec_MonitorEventZ_clone(&owner->b);
5074 }
5075 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5076         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5077         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5078         int64_tArray ret_arr = NULL;
5079         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5080         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5081         for (size_t o = 0; o < ret_var.datalen; o++) {
5082                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5083                 *ret_conv_14_copy = ret_var.data[o];
5084                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5085                 ret_arr_ptr[o] = ret_conv_14_ref;
5086         }
5087         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5088         FREE(ret_var.data);
5089         return ret_arr;
5090 }
5091
5092 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5093         return owner->c;
5094 }
5095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5096         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5097         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
5099         return ret_arr;
5100 }
5101
5102 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
5103         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5104         for (size_t i = 0; i < ret.datalen; i++) {
5105                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5106         }
5107         return ret;
5108 }
5109 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5110         LDKInitFeatures ret = *owner->contents.result;
5111         ret.is_owned = false;
5112         return ret;
5113 }
5114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5115         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5116         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5117         int64_t ret_ref = 0;
5118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5120         return ret_ref;
5121 }
5122
5123 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5124 CHECK(!owner->result_ok);
5125         return DecodeError_clone(&*owner->contents.err);
5126 }
5127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5128         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5129         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5130         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5131         int64_t ret_ref = tag_ptr(ret_copy, true);
5132         return ret_ref;
5133 }
5134
5135 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5136         LDKChannelFeatures ret = *owner->contents.result;
5137         ret.is_owned = false;
5138         return ret;
5139 }
5140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5141         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5142         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5143         int64_t ret_ref = 0;
5144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5146         return ret_ref;
5147 }
5148
5149 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5150 CHECK(!owner->result_ok);
5151         return DecodeError_clone(&*owner->contents.err);
5152 }
5153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5154         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5155         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5156         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5157         int64_t ret_ref = tag_ptr(ret_copy, true);
5158         return ret_ref;
5159 }
5160
5161 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5162         LDKNodeFeatures ret = *owner->contents.result;
5163         ret.is_owned = false;
5164         return ret;
5165 }
5166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5167         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5168         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5169         int64_t ret_ref = 0;
5170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5172         return ret_ref;
5173 }
5174
5175 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5176 CHECK(!owner->result_ok);
5177         return DecodeError_clone(&*owner->contents.err);
5178 }
5179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5180         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5181         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5182         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5183         int64_t ret_ref = tag_ptr(ret_copy, true);
5184         return ret_ref;
5185 }
5186
5187 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5188         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5189         ret.is_owned = false;
5190         return ret;
5191 }
5192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5193         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5194         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5195         int64_t ret_ref = 0;
5196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5198         return ret_ref;
5199 }
5200
5201 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5202 CHECK(!owner->result_ok);
5203         return DecodeError_clone(&*owner->contents.err);
5204 }
5205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5206         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5208         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5209         int64_t ret_ref = tag_ptr(ret_copy, true);
5210         return ret_ref;
5211 }
5212
5213 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5214         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5215         ret.is_owned = false;
5216         return ret;
5217 }
5218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5219         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5220         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5221         int64_t ret_ref = 0;
5222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5224         return ret_ref;
5225 }
5226
5227 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5228 CHECK(!owner->result_ok);
5229         return DecodeError_clone(&*owner->contents.err);
5230 }
5231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5232         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5233         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5234         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5235         int64_t ret_ref = tag_ptr(ret_copy, true);
5236         return ret_ref;
5237 }
5238
5239 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5240         LDKBlindedHopFeatures ret = *owner->contents.result;
5241         ret.is_owned = false;
5242         return ret;
5243 }
5244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5245         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5246         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
5247         int64_t ret_ref = 0;
5248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5250         return ret_ref;
5251 }
5252
5253 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5254 CHECK(!owner->result_ok);
5255         return DecodeError_clone(&*owner->contents.err);
5256 }
5257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5258         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5260         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
5261         int64_t ret_ref = tag_ptr(ret_copy, true);
5262         return ret_ref;
5263 }
5264
5265 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5266         LDKChannelTypeFeatures ret = *owner->contents.result;
5267         ret.is_owned = false;
5268         return ret;
5269 }
5270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5271         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5272         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
5273         int64_t ret_ref = 0;
5274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5276         return ret_ref;
5277 }
5278
5279 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5280 CHECK(!owner->result_ok);
5281         return DecodeError_clone(&*owner->contents.err);
5282 }
5283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5284         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5286         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
5287         int64_t ret_ref = tag_ptr(ret_copy, true);
5288         return ret_ref;
5289 }
5290
5291 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5292         LDKOffer ret = *owner->contents.result;
5293         ret.is_owned = false;
5294         return ret;
5295 }
5296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5297         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5298         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5299         int64_t ret_ref = 0;
5300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5302         return ret_ref;
5303 }
5304
5305 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5306         LDKBolt12ParseError ret = *owner->contents.err;
5307         ret.is_owned = false;
5308         return ret;
5309 }
5310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5311         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5312         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5313         int64_t ret_ref = 0;
5314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5316         return ret_ref;
5317 }
5318
5319 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5320 CHECK(owner->result_ok);
5321         return *owner->contents.result;
5322 }
5323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5324         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5325         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5326         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
5327         return ret_arr;
5328 }
5329
5330 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5331 CHECK(!owner->result_ok);
5332         return *owner->contents.err;
5333 }
5334 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5335         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5336         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
5337         return ret_conv;
5338 }
5339
5340 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5341         LDKNodeId ret = *owner->contents.result;
5342         ret.is_owned = false;
5343         return ret;
5344 }
5345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5346         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5347         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5348         int64_t ret_ref = 0;
5349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5351         return ret_ref;
5352 }
5353
5354 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5355 CHECK(!owner->result_ok);
5356         return DecodeError_clone(&*owner->contents.err);
5357 }
5358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5359         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5360         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5361         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5362         int64_t ret_ref = tag_ptr(ret_copy, true);
5363         return ret_ref;
5364 }
5365
5366 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5367 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5368 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5369 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5370 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5371 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5373         LDKNetworkUpdate_ChannelUpdateMessage_class =
5374                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5375         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5376         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5377         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5378         LDKNetworkUpdate_ChannelFailure_class =
5379                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5380         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5381         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5382         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5383         LDKNetworkUpdate_NodeFailure_class =
5384                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5385         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5386         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5387         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5388 }
5389 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5390         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5391         switch(obj->tag) {
5392                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5393                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5394                         int64_t msg_ref = 0;
5395                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5396                         msg_ref = tag_ptr(msg_var.inner, false);
5397                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5398                 }
5399                 case LDKNetworkUpdate_ChannelFailure: {
5400                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5401                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5402                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5403                 }
5404                 case LDKNetworkUpdate_NodeFailure: {
5405                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5406                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5407                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5408                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5409                 }
5410                 default: abort();
5411         }
5412 }
5413 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5414 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5415 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5416 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5418         LDKCOption_NetworkUpdateZ_Some_class =
5419                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5420         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5421         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5422         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5423         LDKCOption_NetworkUpdateZ_None_class =
5424                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5425         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5426         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5427         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5428 }
5429 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5430         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5431         switch(obj->tag) {
5432                 case LDKCOption_NetworkUpdateZ_Some: {
5433                         int64_t some_ref = tag_ptr(&obj->some, false);
5434                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5435                 }
5436                 case LDKCOption_NetworkUpdateZ_None: {
5437                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5438                 }
5439                 default: abort();
5440         }
5441 }
5442 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5443 CHECK(owner->result_ok);
5444         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5445 }
5446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5447         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5448         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5449         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5450         int64_t ret_ref = tag_ptr(ret_copy, true);
5451         return ret_ref;
5452 }
5453
5454 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5455 CHECK(!owner->result_ok);
5456         return DecodeError_clone(&*owner->contents.err);
5457 }
5458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5459         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5460         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5461         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5462         int64_t ret_ref = tag_ptr(ret_copy, true);
5463         return ret_ref;
5464 }
5465
5466 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5467 CHECK(owner->result_ok);
5468         return TxOut_clone(&*owner->contents.result);
5469 }
5470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5471         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5472         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5473         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5474         return tag_ptr(ret_ref, true);
5475 }
5476
5477 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5478 CHECK(!owner->result_ok);
5479         return UtxoLookupError_clone(&*owner->contents.err);
5480 }
5481 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5482         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5483         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5484         return ret_conv;
5485 }
5486
5487 static jclass LDKUtxoResult_Sync_class = NULL;
5488 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5489 static jclass LDKUtxoResult_Async_class = NULL;
5490 static jmethodID LDKUtxoResult_Async_meth = NULL;
5491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5492         LDKUtxoResult_Sync_class =
5493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5494         CHECK(LDKUtxoResult_Sync_class != NULL);
5495         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5496         CHECK(LDKUtxoResult_Sync_meth != NULL);
5497         LDKUtxoResult_Async_class =
5498                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5499         CHECK(LDKUtxoResult_Async_class != NULL);
5500         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5501         CHECK(LDKUtxoResult_Async_meth != NULL);
5502 }
5503 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5504         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5505         switch(obj->tag) {
5506                 case LDKUtxoResult_Sync: {
5507                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5508                         *sync_conv = obj->sync;
5509                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5510                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5511                 }
5512                 case LDKUtxoResult_Async: {
5513                         LDKUtxoFuture async_var = obj->async;
5514                         int64_t async_ref = 0;
5515                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5516                         async_ref = tag_ptr(async_var.inner, false);
5517                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5518                 }
5519                 default: abort();
5520         }
5521 }
5522 typedef struct LDKUtxoLookup_JCalls {
5523         atomic_size_t refcnt;
5524         JavaVM *vm;
5525         jweak o;
5526         jmethodID get_utxo_meth;
5527 } LDKUtxoLookup_JCalls;
5528 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5529         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5530         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5531                 JNIEnv *env;
5532                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5533                 if (get_jenv_res == JNI_EDETACHED) {
5534                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5535                 } else {
5536                         DO_ASSERT(get_jenv_res == JNI_OK);
5537                 }
5538                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5539                 if (get_jenv_res == JNI_EDETACHED) {
5540                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5541                 }
5542                 FREE(j_calls);
5543         }
5544 }
5545 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5546         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5547         JNIEnv *env;
5548         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5549         if (get_jenv_res == JNI_EDETACHED) {
5550                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5551         } else {
5552                 DO_ASSERT(get_jenv_res == JNI_OK);
5553         }
5554         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5555         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5556         int64_t short_channel_id_conv = short_channel_id;
5557         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5558         CHECK(obj != NULL);
5559         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
5560         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5561                 (*env)->ExceptionDescribe(env);
5562                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5563         }
5564         void* ret_ptr = untag_ptr(ret);
5565         CHECK_ACCESS(ret_ptr);
5566         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5567         FREE(untag_ptr(ret));
5568         if (get_jenv_res == JNI_EDETACHED) {
5569                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5570         }
5571         return ret_conv;
5572 }
5573 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5574         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5575         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5576 }
5577 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5578         jclass c = (*env)->GetObjectClass(env, o);
5579         CHECK(c != NULL);
5580         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5581         atomic_init(&calls->refcnt, 1);
5582         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5583         calls->o = (*env)->NewWeakGlobalRef(env, o);
5584         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5585         CHECK(calls->get_utxo_meth != NULL);
5586
5587         LDKUtxoLookup ret = {
5588                 .this_arg = (void*) calls,
5589                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5590                 .free = LDKUtxoLookup_JCalls_free,
5591         };
5592         return ret;
5593 }
5594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5595         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5596         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5597         return tag_ptr(res_ptr, true);
5598 }
5599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
5600         void* this_arg_ptr = untag_ptr(this_arg);
5601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5602         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5603         uint8_t genesis_hash_arr[32];
5604         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
5605         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
5606         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
5607         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5608         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5609         int64_t ret_ref = tag_ptr(ret_copy, true);
5610         return ret_ref;
5611 }
5612
5613 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5614 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5615 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5616 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5618         LDKCOption_UtxoLookupZ_Some_class =
5619                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5620         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5621         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5622         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5623         LDKCOption_UtxoLookupZ_None_class =
5624                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5625         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5626         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5627         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5628 }
5629 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5630         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5631         switch(obj->tag) {
5632                 case LDKCOption_UtxoLookupZ_Some: {
5633                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5634                         *some_ret = obj->some;
5635                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5636                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5637                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5638                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5639                         }
5640                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5641                 }
5642                 case LDKCOption_UtxoLookupZ_None: {
5643                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5644                 }
5645                 default: abort();
5646         }
5647 }
5648 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5649 CHECK(owner->result_ok);
5650         return *owner->contents.result;
5651 }
5652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5653         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5654         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5655 }
5656
5657 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5658         LDKLightningError ret = *owner->contents.err;
5659         ret.is_owned = false;
5660         return ret;
5661 }
5662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5663         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5664         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5665         int64_t ret_ref = 0;
5666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5668         return ret_ref;
5669 }
5670
5671 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5672 CHECK(owner->result_ok);
5673         return *owner->contents.result;
5674 }
5675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5676         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5677         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5678         return ret_conv;
5679 }
5680
5681 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5682         LDKLightningError ret = *owner->contents.err;
5683         ret.is_owned = false;
5684         return ret;
5685 }
5686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5687         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5688         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5689         int64_t ret_ref = 0;
5690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5692         return ret_ref;
5693 }
5694
5695 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5696         LDKChannelAnnouncement ret = owner->a;
5697         ret.is_owned = false;
5698         return ret;
5699 }
5700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5701         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5702         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5703         int64_t ret_ref = 0;
5704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5706         return ret_ref;
5707 }
5708
5709 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5710         LDKChannelUpdate ret = owner->b;
5711         ret.is_owned = false;
5712         return ret;
5713 }
5714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5715         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5716         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5717         int64_t ret_ref = 0;
5718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5720         return ret_ref;
5721 }
5722
5723 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5724         LDKChannelUpdate ret = owner->c;
5725         ret.is_owned = false;
5726         return ret;
5727 }
5728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5729         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5730         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5731         int64_t ret_ref = 0;
5732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5734         return ret_ref;
5735 }
5736
5737 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5738 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5739 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5740 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5742         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5743                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5744         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5745         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5746         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5747         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5748                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5749         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5750         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5751         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5752 }
5753 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5754         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5755         switch(obj->tag) {
5756                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5757                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5758                         *some_conv = obj->some;
5759                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5760                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5761                 }
5762                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5763                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5764                 }
5765                 default: abort();
5766         }
5767 }
5768 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
5769 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
5770 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
5771 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
5772 static jclass LDKErrorAction_IgnoreError_class = NULL;
5773 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
5774 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
5775 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
5776 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
5777 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
5778 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
5779 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
5780 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
5781 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
5782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
5783         LDKErrorAction_DisconnectPeer_class =
5784                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
5785         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
5786         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
5787         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
5788         LDKErrorAction_DisconnectPeerWithWarning_class =
5789                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
5790         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
5791         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
5792         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
5793         LDKErrorAction_IgnoreError_class =
5794                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
5795         CHECK(LDKErrorAction_IgnoreError_class != NULL);
5796         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
5797         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
5798         LDKErrorAction_IgnoreAndLog_class =
5799                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
5800         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
5801         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
5802         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
5803         LDKErrorAction_IgnoreDuplicateGossip_class =
5804                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
5805         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
5806         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
5807         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
5808         LDKErrorAction_SendErrorMessage_class =
5809                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
5810         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
5811         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
5812         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
5813         LDKErrorAction_SendWarningMessage_class =
5814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
5815         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
5816         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
5817         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
5818 }
5819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5820         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
5821         switch(obj->tag) {
5822                 case LDKErrorAction_DisconnectPeer: {
5823                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
5824                         int64_t msg_ref = 0;
5825                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5826                         msg_ref = tag_ptr(msg_var.inner, false);
5827                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
5828                 }
5829                 case LDKErrorAction_DisconnectPeerWithWarning: {
5830                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
5831                         int64_t msg_ref = 0;
5832                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5833                         msg_ref = tag_ptr(msg_var.inner, false);
5834                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
5835                 }
5836                 case LDKErrorAction_IgnoreError: {
5837                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
5838                 }
5839                 case LDKErrorAction_IgnoreAndLog: {
5840                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
5841                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
5842                 }
5843                 case LDKErrorAction_IgnoreDuplicateGossip: {
5844                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
5845                 }
5846                 case LDKErrorAction_SendErrorMessage: {
5847                         LDKErrorMessage msg_var = obj->send_error_message.msg;
5848                         int64_t msg_ref = 0;
5849                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5850                         msg_ref = tag_ptr(msg_var.inner, false);
5851                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
5852                 }
5853                 case LDKErrorAction_SendWarningMessage: {
5854                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
5855                         int64_t msg_ref = 0;
5856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5857                         msg_ref = tag_ptr(msg_var.inner, false);
5858                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
5859                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
5860                 }
5861                 default: abort();
5862         }
5863 }
5864 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
5865 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
5866 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
5867 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
5868 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
5869 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
5870 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
5871 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
5872 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
5873 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
5874 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
5875 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
5876 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
5877 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
5878 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
5879 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
5880 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
5881 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
5882 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
5883 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
5884 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
5885 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
5886 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
5887 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
5888 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
5889 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
5890 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
5891 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
5892 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
5893 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
5894 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
5895 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
5896 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
5897 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
5898 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
5899 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
5900 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
5901 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
5902 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
5903 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
5904 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
5905 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
5906 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
5907 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
5908 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
5909 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
5910 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
5911 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
5912 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
5913 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
5914 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
5915 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
5916 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
5917 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
5918 static jclass LDKMessageSendEvent_HandleError_class = NULL;
5919 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
5920 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
5921 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
5922 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
5923 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
5924 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
5925 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
5926 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
5927 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
5928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
5929         LDKMessageSendEvent_SendAcceptChannel_class =
5930                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
5931         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
5932         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
5933         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
5934         LDKMessageSendEvent_SendAcceptChannelV2_class =
5935                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
5936         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
5937         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
5938         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
5939         LDKMessageSendEvent_SendOpenChannel_class =
5940                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
5941         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
5942         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
5943         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
5944         LDKMessageSendEvent_SendOpenChannelV2_class =
5945                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
5946         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
5947         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
5948         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
5949         LDKMessageSendEvent_SendFundingCreated_class =
5950                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
5951         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
5952         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
5953         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
5954         LDKMessageSendEvent_SendFundingSigned_class =
5955                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
5956         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
5957         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
5958         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
5959         LDKMessageSendEvent_SendTxAddInput_class =
5960                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
5961         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
5962         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
5963         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
5964         LDKMessageSendEvent_SendTxAddOutput_class =
5965                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
5966         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
5967         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
5968         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
5969         LDKMessageSendEvent_SendTxRemoveInput_class =
5970                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
5971         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
5972         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
5973         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
5974         LDKMessageSendEvent_SendTxRemoveOutput_class =
5975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
5976         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
5977         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
5978         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
5979         LDKMessageSendEvent_SendTxComplete_class =
5980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
5981         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
5982         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
5983         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
5984         LDKMessageSendEvent_SendTxSignatures_class =
5985                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
5986         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
5987         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
5988         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
5989         LDKMessageSendEvent_SendTxInitRbf_class =
5990                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
5991         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
5992         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
5993         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
5994         LDKMessageSendEvent_SendTxAckRbf_class =
5995                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
5996         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
5997         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
5998         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
5999         LDKMessageSendEvent_SendTxAbort_class =
6000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6001         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6002         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6003         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6004         LDKMessageSendEvent_SendChannelReady_class =
6005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6006         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6007         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6008         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6009         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6011         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6012         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6013         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6014         LDKMessageSendEvent_UpdateHTLCs_class =
6015                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6016         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6017         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6018         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6019         LDKMessageSendEvent_SendRevokeAndACK_class =
6020                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6021         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6022         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6023         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6024         LDKMessageSendEvent_SendClosingSigned_class =
6025                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6026         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6027         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6028         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6029         LDKMessageSendEvent_SendShutdown_class =
6030                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6031         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6032         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6033         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6034         LDKMessageSendEvent_SendChannelReestablish_class =
6035                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6036         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6037         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6038         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6039         LDKMessageSendEvent_SendChannelAnnouncement_class =
6040                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6041         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6042         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6043         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6044         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6045                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6046         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6047         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6048         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6049         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6050                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6051         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6052         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6053         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6054         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6055                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6056         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6057         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6058         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6059         LDKMessageSendEvent_SendChannelUpdate_class =
6060                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6061         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6062         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6063         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6064         LDKMessageSendEvent_HandleError_class =
6065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6066         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6067         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6068         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6069         LDKMessageSendEvent_SendChannelRangeQuery_class =
6070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6071         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6072         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6073         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6074         LDKMessageSendEvent_SendShortIdsQuery_class =
6075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6076         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
6077         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
6078         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
6079         LDKMessageSendEvent_SendReplyChannelRange_class =
6080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
6081         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
6082         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
6083         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
6084         LDKMessageSendEvent_SendGossipTimestampFilter_class =
6085                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
6086         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
6087         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
6088         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
6089 }
6090 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6091         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
6092         switch(obj->tag) {
6093                 case LDKMessageSendEvent_SendAcceptChannel: {
6094                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6095                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
6096                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
6097                         int64_t msg_ref = 0;
6098                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6099                         msg_ref = tag_ptr(msg_var.inner, false);
6100                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
6101                 }
6102                 case LDKMessageSendEvent_SendAcceptChannelV2: {
6103                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6104                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
6105                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
6106                         int64_t msg_ref = 0;
6107                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6108                         msg_ref = tag_ptr(msg_var.inner, false);
6109                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
6110                 }
6111                 case LDKMessageSendEvent_SendOpenChannel: {
6112                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6113                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
6114                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
6115                         int64_t msg_ref = 0;
6116                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6117                         msg_ref = tag_ptr(msg_var.inner, false);
6118                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
6119                 }
6120                 case LDKMessageSendEvent_SendOpenChannelV2: {
6121                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6122                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
6123                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
6124                         int64_t msg_ref = 0;
6125                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6126                         msg_ref = tag_ptr(msg_var.inner, false);
6127                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
6128                 }
6129                 case LDKMessageSendEvent_SendFundingCreated: {
6130                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6131                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
6132                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
6133                         int64_t msg_ref = 0;
6134                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6135                         msg_ref = tag_ptr(msg_var.inner, false);
6136                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
6137                 }
6138                 case LDKMessageSendEvent_SendFundingSigned: {
6139                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6140                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
6141                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
6142                         int64_t msg_ref = 0;
6143                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6144                         msg_ref = tag_ptr(msg_var.inner, false);
6145                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
6146                 }
6147                 case LDKMessageSendEvent_SendTxAddInput: {
6148                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6149                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
6150                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
6151                         int64_t msg_ref = 0;
6152                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6153                         msg_ref = tag_ptr(msg_var.inner, false);
6154                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
6155                 }
6156                 case LDKMessageSendEvent_SendTxAddOutput: {
6157                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6158                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
6159                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
6160                         int64_t msg_ref = 0;
6161                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6162                         msg_ref = tag_ptr(msg_var.inner, false);
6163                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
6164                 }
6165                 case LDKMessageSendEvent_SendTxRemoveInput: {
6166                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6167                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
6168                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
6169                         int64_t msg_ref = 0;
6170                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6171                         msg_ref = tag_ptr(msg_var.inner, false);
6172                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
6173                 }
6174                 case LDKMessageSendEvent_SendTxRemoveOutput: {
6175                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6176                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
6177                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
6178                         int64_t msg_ref = 0;
6179                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6180                         msg_ref = tag_ptr(msg_var.inner, false);
6181                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
6182                 }
6183                 case LDKMessageSendEvent_SendTxComplete: {
6184                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6185                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
6186                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
6187                         int64_t msg_ref = 0;
6188                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6189                         msg_ref = tag_ptr(msg_var.inner, false);
6190                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
6191                 }
6192                 case LDKMessageSendEvent_SendTxSignatures: {
6193                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6194                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
6195                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
6196                         int64_t msg_ref = 0;
6197                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6198                         msg_ref = tag_ptr(msg_var.inner, false);
6199                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
6200                 }
6201                 case LDKMessageSendEvent_SendTxInitRbf: {
6202                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6203                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
6204                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
6205                         int64_t msg_ref = 0;
6206                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6207                         msg_ref = tag_ptr(msg_var.inner, false);
6208                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
6209                 }
6210                 case LDKMessageSendEvent_SendTxAckRbf: {
6211                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6212                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
6213                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
6214                         int64_t msg_ref = 0;
6215                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6216                         msg_ref = tag_ptr(msg_var.inner, false);
6217                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
6218                 }
6219                 case LDKMessageSendEvent_SendTxAbort: {
6220                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6221                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
6222                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
6223                         int64_t msg_ref = 0;
6224                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6225                         msg_ref = tag_ptr(msg_var.inner, false);
6226                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
6227                 }
6228                 case LDKMessageSendEvent_SendChannelReady: {
6229                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6230                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
6231                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
6232                         int64_t msg_ref = 0;
6233                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6234                         msg_ref = tag_ptr(msg_var.inner, false);
6235                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
6236                 }
6237                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
6238                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6239                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
6240                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
6241                         int64_t msg_ref = 0;
6242                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6243                         msg_ref = tag_ptr(msg_var.inner, false);
6244                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
6245                 }
6246                 case LDKMessageSendEvent_UpdateHTLCs: {
6247                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6248                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
6249                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
6250                         int64_t updates_ref = 0;
6251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
6252                         updates_ref = tag_ptr(updates_var.inner, false);
6253                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
6254                 }
6255                 case LDKMessageSendEvent_SendRevokeAndACK: {
6256                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6257                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
6258                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
6259                         int64_t msg_ref = 0;
6260                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6261                         msg_ref = tag_ptr(msg_var.inner, false);
6262                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
6263                 }
6264                 case LDKMessageSendEvent_SendClosingSigned: {
6265                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6266                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
6267                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
6268                         int64_t msg_ref = 0;
6269                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6270                         msg_ref = tag_ptr(msg_var.inner, false);
6271                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
6272                 }
6273                 case LDKMessageSendEvent_SendShutdown: {
6274                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6275                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
6276                         LDKShutdown msg_var = obj->send_shutdown.msg;
6277                         int64_t msg_ref = 0;
6278                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6279                         msg_ref = tag_ptr(msg_var.inner, false);
6280                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
6281                 }
6282                 case LDKMessageSendEvent_SendChannelReestablish: {
6283                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6284                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
6285                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
6286                         int64_t msg_ref = 0;
6287                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6288                         msg_ref = tag_ptr(msg_var.inner, false);
6289                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
6290                 }
6291                 case LDKMessageSendEvent_SendChannelAnnouncement: {
6292                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6293                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
6294                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
6295                         int64_t msg_ref = 0;
6296                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6297                         msg_ref = tag_ptr(msg_var.inner, false);
6298                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6299                         int64_t update_msg_ref = 0;
6300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6301                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6302                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6303                 }
6304                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6305                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6306                         int64_t msg_ref = 0;
6307                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6308                         msg_ref = tag_ptr(msg_var.inner, false);
6309                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6310                         int64_t update_msg_ref = 0;
6311                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6312                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6313                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6314                 }
6315                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6316                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6317                         int64_t msg_ref = 0;
6318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6319                         msg_ref = tag_ptr(msg_var.inner, false);
6320                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6321                 }
6322                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6323                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6324                         int64_t msg_ref = 0;
6325                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6326                         msg_ref = tag_ptr(msg_var.inner, false);
6327                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6328                 }
6329                 case LDKMessageSendEvent_SendChannelUpdate: {
6330                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6331                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6332                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6333                         int64_t msg_ref = 0;
6334                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6335                         msg_ref = tag_ptr(msg_var.inner, false);
6336                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6337                 }
6338                 case LDKMessageSendEvent_HandleError: {
6339                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6340                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6341                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6342                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6343                 }
6344                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6345                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6346                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6347                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6348                         int64_t msg_ref = 0;
6349                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6350                         msg_ref = tag_ptr(msg_var.inner, false);
6351                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6352                 }
6353                 case LDKMessageSendEvent_SendShortIdsQuery: {
6354                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6355                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6356                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6357                         int64_t msg_ref = 0;
6358                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6359                         msg_ref = tag_ptr(msg_var.inner, false);
6360                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6361                 }
6362                 case LDKMessageSendEvent_SendReplyChannelRange: {
6363                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6364                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6365                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6366                         int64_t msg_ref = 0;
6367                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6368                         msg_ref = tag_ptr(msg_var.inner, false);
6369                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6370                 }
6371                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6372                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6373                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6374                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.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_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6379                 }
6380                 default: abort();
6381         }
6382 }
6383 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6384         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6385         for (size_t i = 0; i < ret.datalen; i++) {
6386                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6387         }
6388         return ret;
6389 }
6390 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6391         LDKChannelUpdateInfo ret = *owner->contents.result;
6392         ret.is_owned = false;
6393         return ret;
6394 }
6395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6396         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6397         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6398         int64_t ret_ref = 0;
6399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6401         return ret_ref;
6402 }
6403
6404 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6405 CHECK(!owner->result_ok);
6406         return DecodeError_clone(&*owner->contents.err);
6407 }
6408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6409         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6410         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6411         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6412         int64_t ret_ref = tag_ptr(ret_copy, true);
6413         return ret_ref;
6414 }
6415
6416 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6417         LDKChannelInfo ret = *owner->contents.result;
6418         ret.is_owned = false;
6419         return ret;
6420 }
6421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6422         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6423         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6424         int64_t ret_ref = 0;
6425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6427         return ret_ref;
6428 }
6429
6430 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6431 CHECK(!owner->result_ok);
6432         return DecodeError_clone(&*owner->contents.err);
6433 }
6434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6435         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6436         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6437         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6438         int64_t ret_ref = tag_ptr(ret_copy, true);
6439         return ret_ref;
6440 }
6441
6442 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6443         LDKRoutingFees ret = *owner->contents.result;
6444         ret.is_owned = false;
6445         return ret;
6446 }
6447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6448         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6449         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6450         int64_t ret_ref = 0;
6451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6453         return ret_ref;
6454 }
6455
6456 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6457 CHECK(!owner->result_ok);
6458         return DecodeError_clone(&*owner->contents.err);
6459 }
6460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6461         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6462         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6463         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6464         int64_t ret_ref = tag_ptr(ret_copy, true);
6465         return ret_ref;
6466 }
6467
6468 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
6469 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
6470 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
6471 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
6472 static jclass LDKSocketAddress_OnionV2_class = NULL;
6473 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
6474 static jclass LDKSocketAddress_OnionV3_class = NULL;
6475 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
6476 static jclass LDKSocketAddress_Hostname_class = NULL;
6477 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
6478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
6479         LDKSocketAddress_TcpIpV4_class =
6480                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
6481         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
6482         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
6483         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
6484         LDKSocketAddress_TcpIpV6_class =
6485                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
6486         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
6487         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
6488         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
6489         LDKSocketAddress_OnionV2_class =
6490                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
6491         CHECK(LDKSocketAddress_OnionV2_class != NULL);
6492         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
6493         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
6494         LDKSocketAddress_OnionV3_class =
6495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
6496         CHECK(LDKSocketAddress_OnionV3_class != NULL);
6497         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
6498         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
6499         LDKSocketAddress_Hostname_class =
6500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
6501         CHECK(LDKSocketAddress_Hostname_class != NULL);
6502         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
6503         CHECK(LDKSocketAddress_Hostname_meth != NULL);
6504 }
6505 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6506         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
6507         switch(obj->tag) {
6508                 case LDKSocketAddress_TcpIpV4: {
6509                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6510                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
6511                         int16_t port_conv = obj->tcp_ip_v4.port;
6512                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
6513                 }
6514                 case LDKSocketAddress_TcpIpV6: {
6515                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6516                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
6517                         int16_t port_conv = obj->tcp_ip_v6.port;
6518                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
6519                 }
6520                 case LDKSocketAddress_OnionV2: {
6521                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6522                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6523                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
6524                 }
6525                 case LDKSocketAddress_OnionV3: {
6526                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6527                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6528                         int16_t checksum_conv = obj->onion_v3.checksum;
6529                         int8_t version_conv = obj->onion_v3.version;
6530                         int16_t port_conv = obj->onion_v3.port;
6531                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6532                 }
6533                 case LDKSocketAddress_Hostname: {
6534                         LDKHostname hostname_var = obj->hostname.hostname;
6535                         int64_t hostname_ref = 0;
6536                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6537                         hostname_ref = tag_ptr(hostname_var.inner, false);
6538                         int16_t port_conv = obj->hostname.port;
6539                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
6540                 }
6541                 default: abort();
6542         }
6543 }
6544 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
6545         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
6546         for (size_t i = 0; i < ret.datalen; i++) {
6547                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
6548         }
6549         return ret;
6550 }
6551 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6552         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6553         ret.is_owned = false;
6554         return ret;
6555 }
6556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6557         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6558         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6559         int64_t ret_ref = 0;
6560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6562         return ret_ref;
6563 }
6564
6565 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6566 CHECK(!owner->result_ok);
6567         return DecodeError_clone(&*owner->contents.err);
6568 }
6569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6570         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6572         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6573         int64_t ret_ref = tag_ptr(ret_copy, true);
6574         return ret_ref;
6575 }
6576
6577 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6578         LDKNodeAlias ret = *owner->contents.result;
6579         ret.is_owned = false;
6580         return ret;
6581 }
6582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6583         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6584         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6585         int64_t ret_ref = 0;
6586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6588         return ret_ref;
6589 }
6590
6591 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6592 CHECK(!owner->result_ok);
6593         return DecodeError_clone(&*owner->contents.err);
6594 }
6595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6596         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6598         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6599         int64_t ret_ref = tag_ptr(ret_copy, true);
6600         return ret_ref;
6601 }
6602
6603 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6604         LDKNodeInfo ret = *owner->contents.result;
6605         ret.is_owned = false;
6606         return ret;
6607 }
6608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6609         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6610         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6611         int64_t ret_ref = 0;
6612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6614         return ret_ref;
6615 }
6616
6617 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6618 CHECK(!owner->result_ok);
6619         return DecodeError_clone(&*owner->contents.err);
6620 }
6621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6622         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6623         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6624         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6625         int64_t ret_ref = tag_ptr(ret_copy, true);
6626         return ret_ref;
6627 }
6628
6629 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6630         LDKNetworkGraph ret = *owner->contents.result;
6631         ret.is_owned = false;
6632         return ret;
6633 }
6634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6635         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6636         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6637         int64_t ret_ref = 0;
6638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6640         return ret_ref;
6641 }
6642
6643 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6644 CHECK(!owner->result_ok);
6645         return DecodeError_clone(&*owner->contents.err);
6646 }
6647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6648         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6649         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6650         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6651         int64_t ret_ref = tag_ptr(ret_copy, true);
6652         return ret_ref;
6653 }
6654
6655 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
6656 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
6657 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
6658 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
6659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
6660         LDKCOption_CVec_SocketAddressZZ_Some_class =
6661                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
6662         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
6663         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
6664         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
6665         LDKCOption_CVec_SocketAddressZZ_None_class =
6666                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
6667         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
6668         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
6669         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
6670 }
6671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6672         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
6673         switch(obj->tag) {
6674                 case LDKCOption_CVec_SocketAddressZZ_Some: {
6675                         LDKCVec_SocketAddressZ some_var = obj->some;
6676                         int64_tArray some_arr = NULL;
6677                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6678                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6679                         for (size_t p = 0; p < some_var.datalen; p++) {
6680                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
6681                                 some_arr_ptr[p] = some_conv_15_ref;
6682                         }
6683                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6684                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
6685                 }
6686                 case LDKCOption_CVec_SocketAddressZZ_None: {
6687                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
6688                 }
6689                 default: abort();
6690         }
6691 }
6692 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
6693         LDKChannelDerivationParameters ret = *owner->contents.result;
6694         ret.is_owned = false;
6695         return ret;
6696 }
6697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6698         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
6699         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
6700         int64_t ret_ref = 0;
6701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6703         return ret_ref;
6704 }
6705
6706 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
6707 CHECK(!owner->result_ok);
6708         return DecodeError_clone(&*owner->contents.err);
6709 }
6710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6711         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
6712         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6713         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
6714         int64_t ret_ref = tag_ptr(ret_copy, true);
6715         return ret_ref;
6716 }
6717
6718 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
6719         LDKHTLCDescriptor ret = *owner->contents.result;
6720         ret.is_owned = false;
6721         return ret;
6722 }
6723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6724         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
6725         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
6726         int64_t ret_ref = 0;
6727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6729         return ret_ref;
6730 }
6731
6732 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
6733 CHECK(!owner->result_ok);
6734         return DecodeError_clone(&*owner->contents.err);
6735 }
6736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6737         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
6738         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6739         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
6740         int64_t ret_ref = tag_ptr(ret_copy, true);
6741         return ret_ref;
6742 }
6743
6744 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
6745         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
6746         for (size_t i = 0; i < ret.datalen; i++) {
6747                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
6748         }
6749         return ret;
6750 }
6751 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
6752         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
6753         for (size_t i = 0; i < ret.datalen; i++) {
6754                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
6755         }
6756         return ret;
6757 }
6758 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
6759         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
6760         for (size_t i = 0; i < ret.datalen; i++) {
6761                 ret.data[i] = Utxo_clone(&orig->data[i]);
6762         }
6763         return ret;
6764 }
6765 static jclass LDKCOption_TxOutZ_Some_class = NULL;
6766 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
6767 static jclass LDKCOption_TxOutZ_None_class = NULL;
6768 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
6769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
6770         LDKCOption_TxOutZ_Some_class =
6771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
6772         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
6773         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
6774         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
6775         LDKCOption_TxOutZ_None_class =
6776                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
6777         CHECK(LDKCOption_TxOutZ_None_class != NULL);
6778         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
6779         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
6780 }
6781 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6782         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
6783         switch(obj->tag) {
6784                 case LDKCOption_TxOutZ_Some: {
6785                         LDKTxOut* some_ref = &obj->some;
6786                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
6787                 }
6788                 case LDKCOption_TxOutZ_None: {
6789                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
6790                 }
6791                 default: abort();
6792         }
6793 }
6794 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
6795         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
6796         for (size_t i = 0; i < ret.datalen; i++) {
6797                 ret.data[i] = Input_clone(&orig->data[i]);
6798         }
6799         return ret;
6800 }
6801 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6802         LDKCoinSelection ret = *owner->contents.result;
6803         ret.is_owned = false;
6804         return ret;
6805 }
6806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6807         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6808         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
6809         int64_t ret_ref = 0;
6810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6812         return ret_ref;
6813 }
6814
6815 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6816 CHECK(!owner->result_ok);
6817         return *owner->contents.err;
6818 }
6819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6820         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6821         CResult_CoinSelectionNoneZ_get_err(owner_conv);
6822 }
6823
6824 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6825 CHECK(owner->result_ok);
6826         return CVec_UtxoZ_clone(&*owner->contents.result);
6827 }
6828 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6829         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6830         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
6831         int64_tArray ret_arr = NULL;
6832         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6833         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6834         for (size_t g = 0; g < ret_var.datalen; g++) {
6835                 LDKUtxo ret_conv_6_var = ret_var.data[g];
6836                 int64_t ret_conv_6_ref = 0;
6837                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
6838                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
6839                 ret_arr_ptr[g] = ret_conv_6_ref;
6840         }
6841         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6842         FREE(ret_var.data);
6843         return ret_arr;
6844 }
6845
6846 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6847 CHECK(!owner->result_ok);
6848         return *owner->contents.err;
6849 }
6850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6851         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6852         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
6853 }
6854
6855 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6856         return owner->a;
6857 }
6858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6859         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6860         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
6861         return ret_conv;
6862 }
6863
6864 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6865         return owner->b;
6866 }
6867 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6868         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6869         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
6870         return ret_conv;
6871 }
6872
6873 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
6874 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
6875 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
6876 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
6877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
6878         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
6879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
6880         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
6881         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
6882         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
6883         LDKCOption_C2Tuple_u64u16ZZ_None_class =
6884                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
6885         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
6886         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
6887         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
6888 }
6889 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6890         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
6891         switch(obj->tag) {
6892                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
6893                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
6894                         *some_conv = obj->some;
6895                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
6896                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
6897                 }
6898                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
6899                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
6900                 }
6901                 default: abort();
6902         }
6903 }
6904 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
6905 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
6906 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
6907 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
6908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
6909         LDKCOption_ChannelShutdownStateZ_Some_class =
6910                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
6911         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
6912         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
6913         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
6914         LDKCOption_ChannelShutdownStateZ_None_class =
6915                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
6916         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
6917         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
6918         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
6919 }
6920 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6921         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
6922         switch(obj->tag) {
6923                 case LDKCOption_ChannelShutdownStateZ_Some: {
6924                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
6925                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
6926                 }
6927                 case LDKCOption_ChannelShutdownStateZ_None: {
6928                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
6929                 }
6930                 default: abort();
6931         }
6932 }
6933 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6934 CHECK(owner->result_ok);
6935         return ThirtyTwoBytes_clone(&*owner->contents.result);
6936 }
6937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6938         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6939         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6940         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
6941         return ret_arr;
6942 }
6943
6944 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6945 CHECK(!owner->result_ok);
6946         return APIError_clone(&*owner->contents.err);
6947 }
6948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6949         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6950         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6951         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
6952         int64_t ret_ref = tag_ptr(ret_copy, true);
6953         return ret_ref;
6954 }
6955
6956 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
6957 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
6958 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6959 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6960 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6961 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6962 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6963 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6965         LDKRecentPaymentDetails_AwaitingInvoice_class =
6966                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
6967         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
6968         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
6969         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
6970         LDKRecentPaymentDetails_Pending_class =
6971                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
6972         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
6973         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
6974         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
6975         LDKRecentPaymentDetails_Fulfilled_class =
6976                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
6977         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
6978         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
6979         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
6980         LDKRecentPaymentDetails_Abandoned_class =
6981                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
6982         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
6983         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
6984         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
6985 }
6986 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6987         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6988         switch(obj->tag) {
6989                 case LDKRecentPaymentDetails_AwaitingInvoice: {
6990                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6991                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
6992                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
6993                 }
6994                 case LDKRecentPaymentDetails_Pending: {
6995                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6996                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
6997                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6998                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
6999                         int64_t total_msat_conv = obj->pending.total_msat;
7000                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
7001                 }
7002                 case LDKRecentPaymentDetails_Fulfilled: {
7003                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7004                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
7005                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
7006                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
7007                 }
7008                 case LDKRecentPaymentDetails_Abandoned: {
7009                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7010                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
7011                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7012                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
7013                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
7014                 }
7015                 default: abort();
7016         }
7017 }
7018 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
7019         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
7020         for (size_t i = 0; i < ret.datalen; i++) {
7021                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
7022         }
7023         return ret;
7024 }
7025 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
7026 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
7027 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
7028 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
7029 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
7030 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
7031 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
7032 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
7033 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
7034 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
7035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
7036         LDKPaymentSendFailure_ParameterError_class =
7037                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
7038         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
7039         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
7040         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
7041         LDKPaymentSendFailure_PathParameterError_class =
7042                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
7043         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
7044         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
7045         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
7046         LDKPaymentSendFailure_AllFailedResendSafe_class =
7047                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
7048         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
7049         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
7050         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
7051         LDKPaymentSendFailure_DuplicatePayment_class =
7052                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
7053         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
7054         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
7055         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
7056         LDKPaymentSendFailure_PartialFailure_class =
7057                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
7058         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
7059         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
7060         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
7061 }
7062 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7063         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
7064         switch(obj->tag) {
7065                 case LDKPaymentSendFailure_ParameterError: {
7066                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
7067                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
7068                 }
7069                 case LDKPaymentSendFailure_PathParameterError: {
7070                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
7071                         int64_tArray path_parameter_error_arr = NULL;
7072                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
7073                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
7074                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
7075                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7076                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
7077                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
7078                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
7079                         }
7080                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
7081                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
7082                 }
7083                 case LDKPaymentSendFailure_AllFailedResendSafe: {
7084                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
7085                         int64_tArray all_failed_resend_safe_arr = NULL;
7086                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
7087                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
7088                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
7089                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
7090                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
7091                         }
7092                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
7093                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
7094                 }
7095                 case LDKPaymentSendFailure_DuplicatePayment: {
7096                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
7097                 }
7098                 case LDKPaymentSendFailure_PartialFailure: {
7099                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
7100                         int64_tArray results_arr = NULL;
7101                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
7102                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
7103                         for (size_t w = 0; w < results_var.datalen; w++) {
7104                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7105                                 *results_conv_22_conv = results_var.data[w];
7106                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
7107                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
7108                         }
7109                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
7110                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
7111                         int64_t failed_paths_retry_ref = 0;
7112                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
7113                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
7114                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7115                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
7116                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
7117                 }
7118                 default: abort();
7119         }
7120 }
7121 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7122 CHECK(owner->result_ok);
7123         return *owner->contents.result;
7124 }
7125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7126         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7127         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
7128 }
7129
7130 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7131 CHECK(!owner->result_ok);
7132         return PaymentSendFailure_clone(&*owner->contents.err);
7133 }
7134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7135         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7136         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7137         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
7138         int64_t ret_ref = tag_ptr(ret_copy, true);
7139         return ret_ref;
7140 }
7141
7142 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7143 CHECK(owner->result_ok);
7144         return *owner->contents.result;
7145 }
7146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7147         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7148         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
7149 }
7150
7151 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7152 CHECK(!owner->result_ok);
7153         return RetryableSendFailure_clone(&*owner->contents.err);
7154 }
7155 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7156         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7157         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
7158         return ret_conv;
7159 }
7160
7161 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7162 CHECK(owner->result_ok);
7163         return ThirtyTwoBytes_clone(&*owner->contents.result);
7164 }
7165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7166         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7167         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7168         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
7169         return ret_arr;
7170 }
7171
7172 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7173 CHECK(!owner->result_ok);
7174         return PaymentSendFailure_clone(&*owner->contents.err);
7175 }
7176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7177         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7178         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7179         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
7180         int64_t ret_ref = tag_ptr(ret_copy, true);
7181         return ret_ref;
7182 }
7183
7184 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7185 CHECK(owner->result_ok);
7186         return ThirtyTwoBytes_clone(&*owner->contents.result);
7187 }
7188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7189         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7190         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7191         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
7192         return ret_arr;
7193 }
7194
7195 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7196 CHECK(!owner->result_ok);
7197         return RetryableSendFailure_clone(&*owner->contents.err);
7198 }
7199 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7200         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7201         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
7202         return ret_conv;
7203 }
7204
7205 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7206         return ThirtyTwoBytes_clone(&owner->a);
7207 }
7208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7209         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7210         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7211         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
7212         return ret_arr;
7213 }
7214
7215 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7216         return ThirtyTwoBytes_clone(&owner->b);
7217 }
7218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7219         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7220         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7221         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
7222         return ret_arr;
7223 }
7224
7225 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7226 CHECK(owner->result_ok);
7227         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7228 }
7229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7230         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7231         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7232         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
7233         return tag_ptr(ret_conv, true);
7234 }
7235
7236 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7237 CHECK(!owner->result_ok);
7238         return PaymentSendFailure_clone(&*owner->contents.err);
7239 }
7240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7241         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7242         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7243         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
7244         int64_t ret_ref = tag_ptr(ret_copy, true);
7245         return ret_ref;
7246 }
7247
7248 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
7249         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
7250         for (size_t i = 0; i < ret.datalen; i++) {
7251                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
7252         }
7253         return ret;
7254 }
7255 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
7256 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
7257 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
7258 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
7259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
7260         LDKProbeSendFailure_RouteNotFound_class =
7261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
7262         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
7263         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
7264         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
7265         LDKProbeSendFailure_SendingFailed_class =
7266                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
7267         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
7268         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
7269         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
7270 }
7271 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7272         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
7273         switch(obj->tag) {
7274                 case LDKProbeSendFailure_RouteNotFound: {
7275                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
7276                 }
7277                 case LDKProbeSendFailure_SendingFailed: {
7278                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
7279                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
7280                 }
7281                 default: abort();
7282         }
7283 }
7284 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7285 CHECK(owner->result_ok);
7286         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
7287 }
7288 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7289         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7290         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
7291         int64_tArray ret_arr = NULL;
7292         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7293         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7294         for (size_t o = 0; o < ret_var.datalen; o++) {
7295                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7296                 *ret_conv_40_conv = ret_var.data[o];
7297                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7298         }
7299         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7300         FREE(ret_var.data);
7301         return ret_arr;
7302 }
7303
7304 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7305 CHECK(!owner->result_ok);
7306         return ProbeSendFailure_clone(&*owner->contents.err);
7307 }
7308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7309         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7310         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
7311         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
7312         int64_t ret_ref = tag_ptr(ret_copy, true);
7313         return ret_ref;
7314 }
7315
7316 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7317         return ThirtyTwoBytes_clone(&owner->a);
7318 }
7319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7320         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7321         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7322         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data);
7323         return ret_arr;
7324 }
7325
7326 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7327         return owner->b;
7328 }
7329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7330         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7331         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form);
7333         return ret_arr;
7334 }
7335
7336 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
7337         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
7338         for (size_t i = 0; i < ret.datalen; i++) {
7339                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
7340         }
7341         return ret;
7342 }
7343 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7344 CHECK(owner->result_ok);
7345         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7346 }
7347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7348         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7349         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7350         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
7351         return tag_ptr(ret_conv, true);
7352 }
7353
7354 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7355 CHECK(!owner->result_ok);
7356         return *owner->contents.err;
7357 }
7358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7359         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7360         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
7361 }
7362
7363 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7364         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7365         ret.is_owned = false;
7366         return ret;
7367 }
7368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7369         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7370         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7371         int64_t ret_ref = 0;
7372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7374         return ret_ref;
7375 }
7376
7377 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7378 CHECK(!owner->result_ok);
7379         return DecodeError_clone(&*owner->contents.err);
7380 }
7381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7382         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7383         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7384         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7385         int64_t ret_ref = tag_ptr(ret_copy, true);
7386         return ret_ref;
7387 }
7388
7389 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7390         LDKChannelCounterparty ret = *owner->contents.result;
7391         ret.is_owned = false;
7392         return ret;
7393 }
7394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7395         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7396         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7397         int64_t ret_ref = 0;
7398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7400         return ret_ref;
7401 }
7402
7403 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7404 CHECK(!owner->result_ok);
7405         return DecodeError_clone(&*owner->contents.err);
7406 }
7407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7408         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7409         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7410         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7411         int64_t ret_ref = tag_ptr(ret_copy, true);
7412         return ret_ref;
7413 }
7414
7415 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7416         LDKChannelDetails ret = *owner->contents.result;
7417         ret.is_owned = false;
7418         return ret;
7419 }
7420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7421         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7422         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7423         int64_t ret_ref = 0;
7424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7426         return ret_ref;
7427 }
7428
7429 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7430 CHECK(!owner->result_ok);
7431         return DecodeError_clone(&*owner->contents.err);
7432 }
7433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7434         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7435         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7436         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7437         int64_t ret_ref = tag_ptr(ret_copy, true);
7438         return ret_ref;
7439 }
7440
7441 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7442         LDKPhantomRouteHints ret = *owner->contents.result;
7443         ret.is_owned = false;
7444         return ret;
7445 }
7446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7447         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7448         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7449         int64_t ret_ref = 0;
7450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7452         return ret_ref;
7453 }
7454
7455 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7456 CHECK(!owner->result_ok);
7457         return DecodeError_clone(&*owner->contents.err);
7458 }
7459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7460         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7461         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7462         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7463         int64_t ret_ref = tag_ptr(ret_copy, true);
7464         return ret_ref;
7465 }
7466
7467 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7468 CHECK(owner->result_ok);
7469         return ChannelShutdownState_clone(&*owner->contents.result);
7470 }
7471 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7472         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7473         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
7474         return ret_conv;
7475 }
7476
7477 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7478 CHECK(!owner->result_ok);
7479         return DecodeError_clone(&*owner->contents.err);
7480 }
7481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7482         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7483         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7484         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
7485         int64_t ret_ref = tag_ptr(ret_copy, true);
7486         return ret_ref;
7487 }
7488
7489 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7490         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7491         for (size_t i = 0; i < ret.datalen; i++) {
7492                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7493         }
7494         return ret;
7495 }
7496 typedef struct LDKWatch_JCalls {
7497         atomic_size_t refcnt;
7498         JavaVM *vm;
7499         jweak o;
7500         jmethodID watch_channel_meth;
7501         jmethodID update_channel_meth;
7502         jmethodID release_pending_monitor_events_meth;
7503 } LDKWatch_JCalls;
7504 static void LDKWatch_JCalls_free(void* this_arg) {
7505         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7506         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7507                 JNIEnv *env;
7508                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7509                 if (get_jenv_res == JNI_EDETACHED) {
7510                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7511                 } else {
7512                         DO_ASSERT(get_jenv_res == JNI_OK);
7513                 }
7514                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7515                 if (get_jenv_res == JNI_EDETACHED) {
7516                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7517                 }
7518                 FREE(j_calls);
7519         }
7520 }
7521 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7522         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7523         JNIEnv *env;
7524         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7525         if (get_jenv_res == JNI_EDETACHED) {
7526                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7527         } else {
7528                 DO_ASSERT(get_jenv_res == JNI_OK);
7529         }
7530         LDKOutPoint funding_txo_var = funding_txo;
7531         int64_t funding_txo_ref = 0;
7532         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7533         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7534         LDKChannelMonitor monitor_var = monitor;
7535         int64_t monitor_ref = 0;
7536         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7537         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7538         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7539         CHECK(obj != NULL);
7540         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7541         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7542                 (*env)->ExceptionDescribe(env);
7543                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7544         }
7545         void* ret_ptr = untag_ptr(ret);
7546         CHECK_ACCESS(ret_ptr);
7547         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
7548         FREE(untag_ptr(ret));
7549         if (get_jenv_res == JNI_EDETACHED) {
7550                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7551         }
7552         return ret_conv;
7553 }
7554 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7555         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7556         JNIEnv *env;
7557         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7558         if (get_jenv_res == JNI_EDETACHED) {
7559                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7560         } else {
7561                 DO_ASSERT(get_jenv_res == JNI_OK);
7562         }
7563         LDKOutPoint funding_txo_var = funding_txo;
7564         int64_t funding_txo_ref = 0;
7565         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7566         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7567         LDKChannelMonitorUpdate update_var = *update;
7568         int64_t update_ref = 0;
7569         update_var = ChannelMonitorUpdate_clone(&update_var);
7570         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7571         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7572         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7573         CHECK(obj != NULL);
7574         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7575         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7576                 (*env)->ExceptionDescribe(env);
7577                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7578         }
7579         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7580         if (get_jenv_res == JNI_EDETACHED) {
7581                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7582         }
7583         return ret_conv;
7584 }
7585 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7586         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7587         JNIEnv *env;
7588         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7589         if (get_jenv_res == JNI_EDETACHED) {
7590                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7591         } else {
7592                 DO_ASSERT(get_jenv_res == JNI_OK);
7593         }
7594         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7595         CHECK(obj != NULL);
7596         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7597         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7598                 (*env)->ExceptionDescribe(env);
7599                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7600         }
7601         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7602         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7603         if (ret_constr.datalen > 0)
7604                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7605         else
7606                 ret_constr.data = NULL;
7607         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7608         for (size_t x = 0; x < ret_constr.datalen; x++) {
7609                 int64_t ret_conv_49 = ret_vals[x];
7610                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7611                 CHECK_ACCESS(ret_conv_49_ptr);
7612                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7613                 FREE(untag_ptr(ret_conv_49));
7614                 ret_constr.data[x] = ret_conv_49_conv;
7615         }
7616         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7617         if (get_jenv_res == JNI_EDETACHED) {
7618                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7619         }
7620         return ret_constr;
7621 }
7622 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7623         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7624         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7625 }
7626 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7627         jclass c = (*env)->GetObjectClass(env, o);
7628         CHECK(c != NULL);
7629         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7630         atomic_init(&calls->refcnt, 1);
7631         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7632         calls->o = (*env)->NewWeakGlobalRef(env, o);
7633         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
7634         CHECK(calls->watch_channel_meth != NULL);
7635         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7636         CHECK(calls->update_channel_meth != NULL);
7637         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7638         CHECK(calls->release_pending_monitor_events_meth != NULL);
7639
7640         LDKWatch ret = {
7641                 .this_arg = (void*) calls,
7642                 .watch_channel = watch_channel_LDKWatch_jcall,
7643                 .update_channel = update_channel_LDKWatch_jcall,
7644                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7645                 .free = LDKWatch_JCalls_free,
7646         };
7647         return ret;
7648 }
7649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7650         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7651         *res_ptr = LDKWatch_init(env, clz, o);
7652         return tag_ptr(res_ptr, true);
7653 }
7654 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) {
7655         void* this_arg_ptr = untag_ptr(this_arg);
7656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7657         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7658         LDKOutPoint funding_txo_conv;
7659         funding_txo_conv.inner = untag_ptr(funding_txo);
7660         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7661         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7662         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7663         LDKChannelMonitor monitor_conv;
7664         monitor_conv.inner = untag_ptr(monitor);
7665         monitor_conv.is_owned = ptr_is_owned(monitor);
7666         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7667         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7668         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
7669         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
7670         return tag_ptr(ret_conv, true);
7671 }
7672
7673 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) {
7674         void* this_arg_ptr = untag_ptr(this_arg);
7675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7676         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7677         LDKOutPoint funding_txo_conv;
7678         funding_txo_conv.inner = untag_ptr(funding_txo);
7679         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7680         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7681         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7682         LDKChannelMonitorUpdate update_conv;
7683         update_conv.inner = untag_ptr(update);
7684         update_conv.is_owned = ptr_is_owned(update);
7685         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7686         update_conv.is_owned = false;
7687         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7688         return ret_conv;
7689 }
7690
7691 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7692         void* this_arg_ptr = untag_ptr(this_arg);
7693         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7694         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7695         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7696         int64_tArray ret_arr = NULL;
7697         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7698         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7699         for (size_t x = 0; x < ret_var.datalen; x++) {
7700                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7701                 *ret_conv_49_conv = ret_var.data[x];
7702                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7703         }
7704         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7705         FREE(ret_var.data);
7706         return ret_arr;
7707 }
7708
7709 typedef struct LDKBroadcasterInterface_JCalls {
7710         atomic_size_t refcnt;
7711         JavaVM *vm;
7712         jweak o;
7713         jmethodID broadcast_transactions_meth;
7714 } LDKBroadcasterInterface_JCalls;
7715 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7716         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7717         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7718                 JNIEnv *env;
7719                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7720                 if (get_jenv_res == JNI_EDETACHED) {
7721                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7722                 } else {
7723                         DO_ASSERT(get_jenv_res == JNI_OK);
7724                 }
7725                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7726                 if (get_jenv_res == JNI_EDETACHED) {
7727                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7728                 }
7729                 FREE(j_calls);
7730         }
7731 }
7732 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7733         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7734         JNIEnv *env;
7735         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7736         if (get_jenv_res == JNI_EDETACHED) {
7737                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7738         } else {
7739                 DO_ASSERT(get_jenv_res == JNI_OK);
7740         }
7741         LDKCVec_TransactionZ txs_var = txs;
7742         jobjectArray txs_arr = NULL;
7743         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
7744         ;
7745         for (size_t i = 0; i < txs_var.datalen; i++) {
7746                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7747                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
7748                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
7749                 Transaction_free(txs_conv_8_var);
7750                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
7751         }
7752         
7753         FREE(txs_var.data);
7754         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7755         CHECK(obj != NULL);
7756         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
7757         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7758                 (*env)->ExceptionDescribe(env);
7759                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
7760         }
7761         if (get_jenv_res == JNI_EDETACHED) {
7762                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7763         }
7764 }
7765 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7766         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7767         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7768 }
7769 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7770         jclass c = (*env)->GetObjectClass(env, o);
7771         CHECK(c != NULL);
7772         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7773         atomic_init(&calls->refcnt, 1);
7774         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7775         calls->o = (*env)->NewWeakGlobalRef(env, o);
7776         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
7777         CHECK(calls->broadcast_transactions_meth != NULL);
7778
7779         LDKBroadcasterInterface ret = {
7780                 .this_arg = (void*) calls,
7781                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
7782                 .free = LDKBroadcasterInterface_JCalls_free,
7783         };
7784         return ret;
7785 }
7786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7787         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7788         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
7789         return tag_ptr(res_ptr, true);
7790 }
7791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
7792         void* this_arg_ptr = untag_ptr(this_arg);
7793         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7794         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7795         LDKCVec_TransactionZ txs_constr;
7796         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
7797         if (txs_constr.datalen > 0)
7798                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7799         else
7800                 txs_constr.data = NULL;
7801         for (size_t i = 0; i < txs_constr.datalen; i++) {
7802                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
7803                 LDKTransaction txs_conv_8_ref;
7804                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
7805                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
7806                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
7807                 txs_conv_8_ref.data_is_owned = true;
7808                 txs_constr.data[i] = txs_conv_8_ref;
7809         }
7810         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
7811 }
7812
7813 typedef struct LDKEntropySource_JCalls {
7814         atomic_size_t refcnt;
7815         JavaVM *vm;
7816         jweak o;
7817         jmethodID get_secure_random_bytes_meth;
7818 } LDKEntropySource_JCalls;
7819 static void LDKEntropySource_JCalls_free(void* this_arg) {
7820         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7821         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7822                 JNIEnv *env;
7823                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7824                 if (get_jenv_res == JNI_EDETACHED) {
7825                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7826                 } else {
7827                         DO_ASSERT(get_jenv_res == JNI_OK);
7828                 }
7829                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7830                 if (get_jenv_res == JNI_EDETACHED) {
7831                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7832                 }
7833                 FREE(j_calls);
7834         }
7835 }
7836 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7837         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7838         JNIEnv *env;
7839         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7840         if (get_jenv_res == JNI_EDETACHED) {
7841                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7842         } else {
7843                 DO_ASSERT(get_jenv_res == JNI_OK);
7844         }
7845         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7846         CHECK(obj != NULL);
7847         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
7848         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7849                 (*env)->ExceptionDescribe(env);
7850                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
7851         }
7852         LDKThirtyTwoBytes ret_ref;
7853         CHECK((*env)->GetArrayLength(env, ret) == 32);
7854         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7855         if (get_jenv_res == JNI_EDETACHED) {
7856                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7857         }
7858         return ret_ref;
7859 }
7860 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7861         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7862         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7863 }
7864 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
7865         jclass c = (*env)->GetObjectClass(env, o);
7866         CHECK(c != NULL);
7867         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7868         atomic_init(&calls->refcnt, 1);
7869         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7870         calls->o = (*env)->NewWeakGlobalRef(env, o);
7871         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7872         CHECK(calls->get_secure_random_bytes_meth != NULL);
7873
7874         LDKEntropySource ret = {
7875                 .this_arg = (void*) calls,
7876                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7877                 .free = LDKEntropySource_JCalls_free,
7878         };
7879         return ret;
7880 }
7881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
7882         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7883         *res_ptr = LDKEntropySource_init(env, clz, o);
7884         return tag_ptr(res_ptr, true);
7885 }
7886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7887         void* this_arg_ptr = untag_ptr(this_arg);
7888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7889         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7890         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7891         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7892         return ret_arr;
7893 }
7894
7895 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
7896 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
7897 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
7898 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
7899 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
7900 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
7901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
7902         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
7903                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
7904         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
7905         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
7906         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
7907         LDKUnsignedGossipMessage_ChannelUpdate_class =
7908                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
7909         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
7910         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
7911         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
7912         LDKUnsignedGossipMessage_NodeAnnouncement_class =
7913                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
7914         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
7915         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
7916         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
7917 }
7918 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7919         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7920         switch(obj->tag) {
7921                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
7922                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7923                         int64_t channel_announcement_ref = 0;
7924                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7925                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7926                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
7927                 }
7928                 case LDKUnsignedGossipMessage_ChannelUpdate: {
7929                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7930                         int64_t channel_update_ref = 0;
7931                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7932                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7933                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
7934                 }
7935                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
7936                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7937                         int64_t node_announcement_ref = 0;
7938                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7939                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7940                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
7941                 }
7942                 default: abort();
7943         }
7944 }
7945 typedef struct LDKNodeSigner_JCalls {
7946         atomic_size_t refcnt;
7947         JavaVM *vm;
7948         jweak o;
7949         jmethodID get_inbound_payment_key_material_meth;
7950         jmethodID get_node_id_meth;
7951         jmethodID ecdh_meth;
7952         jmethodID sign_invoice_meth;
7953         jmethodID sign_bolt12_invoice_request_meth;
7954         jmethodID sign_bolt12_invoice_meth;
7955         jmethodID sign_gossip_message_meth;
7956 } LDKNodeSigner_JCalls;
7957 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7958         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7959         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7960                 JNIEnv *env;
7961                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7962                 if (get_jenv_res == JNI_EDETACHED) {
7963                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7964                 } else {
7965                         DO_ASSERT(get_jenv_res == JNI_OK);
7966                 }
7967                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7968                 if (get_jenv_res == JNI_EDETACHED) {
7969                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7970                 }
7971                 FREE(j_calls);
7972         }
7973 }
7974 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7975         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7976         JNIEnv *env;
7977         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7978         if (get_jenv_res == JNI_EDETACHED) {
7979                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7980         } else {
7981                 DO_ASSERT(get_jenv_res == JNI_OK);
7982         }
7983         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7984         CHECK(obj != NULL);
7985         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7986         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7987                 (*env)->ExceptionDescribe(env);
7988                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
7989         }
7990         LDKThirtyTwoBytes ret_ref;
7991         CHECK((*env)->GetArrayLength(env, ret) == 32);
7992         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7993         if (get_jenv_res == JNI_EDETACHED) {
7994                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7995         }
7996         return ret_ref;
7997 }
7998 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
7999         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8000         JNIEnv *env;
8001         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8002         if (get_jenv_res == JNI_EDETACHED) {
8003                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8004         } else {
8005                 DO_ASSERT(get_jenv_res == JNI_OK);
8006         }
8007         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8008         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8009         CHECK(obj != NULL);
8010         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
8011         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8012                 (*env)->ExceptionDescribe(env);
8013                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
8014         }
8015         void* ret_ptr = untag_ptr(ret);
8016         CHECK_ACCESS(ret_ptr);
8017         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
8018         FREE(untag_ptr(ret));
8019         if (get_jenv_res == JNI_EDETACHED) {
8020                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8021         }
8022         return ret_conv;
8023 }
8024 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
8025         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8026         JNIEnv *env;
8027         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8028         if (get_jenv_res == JNI_EDETACHED) {
8029                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8030         } else {
8031                 DO_ASSERT(get_jenv_res == JNI_OK);
8032         }
8033         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8034         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
8035         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
8036         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
8037         *tweak_copy = tweak;
8038         int64_t tweak_ref = tag_ptr(tweak_copy, true);
8039         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8040         CHECK(obj != NULL);
8041         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
8042         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8043                 (*env)->ExceptionDescribe(env);
8044                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
8045         }
8046         void* ret_ptr = untag_ptr(ret);
8047         CHECK_ACCESS(ret_ptr);
8048         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
8049         FREE(untag_ptr(ret));
8050         if (get_jenv_res == JNI_EDETACHED) {
8051                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8052         }
8053         return ret_conv;
8054 }
8055 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
8056         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8057         JNIEnv *env;
8058         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8059         if (get_jenv_res == JNI_EDETACHED) {
8060                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8061         } else {
8062                 DO_ASSERT(get_jenv_res == JNI_OK);
8063         }
8064         LDKu8slice hrp_bytes_var = hrp_bytes;
8065         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
8066         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
8067         LDKCVec_U5Z invoice_data_var = invoice_data;
8068         jobjectArray invoice_data_arr = NULL;
8069         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
8070         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
8071         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
8072                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
8073                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
8074         }
8075         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
8076         FREE(invoice_data_var.data);
8077         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8079         CHECK(obj != NULL);
8080         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
8081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8082                 (*env)->ExceptionDescribe(env);
8083                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
8084         }
8085         void* ret_ptr = untag_ptr(ret);
8086         CHECK_ACCESS(ret_ptr);
8087         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
8088         FREE(untag_ptr(ret));
8089         if (get_jenv_res == JNI_EDETACHED) {
8090                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8091         }
8092         return ret_conv;
8093 }
8094 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
8095         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8096         JNIEnv *env;
8097         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8098         if (get_jenv_res == JNI_EDETACHED) {
8099                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8100         } else {
8101                 DO_ASSERT(get_jenv_res == JNI_OK);
8102         }
8103         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
8104         int64_t invoice_request_ref = 0;
8105         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
8106         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8107         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
8108         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8109         CHECK(obj != NULL);
8110         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
8111         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8112                 (*env)->ExceptionDescribe(env);
8113                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
8114         }
8115         void* ret_ptr = untag_ptr(ret);
8116         CHECK_ACCESS(ret_ptr);
8117         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8118         FREE(untag_ptr(ret));
8119         if (get_jenv_res == JNI_EDETACHED) {
8120                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8121         }
8122         return ret_conv;
8123 }
8124 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
8125         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8126         JNIEnv *env;
8127         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8128         if (get_jenv_res == JNI_EDETACHED) {
8129                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8130         } else {
8131                 DO_ASSERT(get_jenv_res == JNI_OK);
8132         }
8133         LDKUnsignedBolt12Invoice invoice_var = *invoice;
8134         int64_t invoice_ref = 0;
8135         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
8136         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8137         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
8138         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8139         CHECK(obj != NULL);
8140         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
8141         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8142                 (*env)->ExceptionDescribe(env);
8143                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
8144         }
8145         void* ret_ptr = untag_ptr(ret);
8146         CHECK_ACCESS(ret_ptr);
8147         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8148         FREE(untag_ptr(ret));
8149         if (get_jenv_res == JNI_EDETACHED) {
8150                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8151         }
8152         return ret_conv;
8153 }
8154 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
8155         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8156         JNIEnv *env;
8157         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8158         if (get_jenv_res == JNI_EDETACHED) {
8159                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8160         } else {
8161                 DO_ASSERT(get_jenv_res == JNI_OK);
8162         }
8163         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
8164         *msg_copy = msg;
8165         int64_t msg_ref = tag_ptr(msg_copy, true);
8166         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8167         CHECK(obj != NULL);
8168         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
8169         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8170                 (*env)->ExceptionDescribe(env);
8171                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
8172         }
8173         void* ret_ptr = untag_ptr(ret);
8174         CHECK_ACCESS(ret_ptr);
8175         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
8176         FREE(untag_ptr(ret));
8177         if (get_jenv_res == JNI_EDETACHED) {
8178                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8179         }
8180         return ret_conv;
8181 }
8182 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
8183         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
8184         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8185 }
8186 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
8187         jclass c = (*env)->GetObjectClass(env, o);
8188         CHECK(c != NULL);
8189         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
8190         atomic_init(&calls->refcnt, 1);
8191         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8192         calls->o = (*env)->NewWeakGlobalRef(env, o);
8193         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
8194         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
8195         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
8196         CHECK(calls->get_node_id_meth != NULL);
8197         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
8198         CHECK(calls->ecdh_meth != NULL);
8199         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
8200         CHECK(calls->sign_invoice_meth != NULL);
8201         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
8202         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
8203         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
8204         CHECK(calls->sign_bolt12_invoice_meth != NULL);
8205         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
8206         CHECK(calls->sign_gossip_message_meth != NULL);
8207
8208         LDKNodeSigner ret = {
8209                 .this_arg = (void*) calls,
8210                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
8211                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
8212                 .ecdh = ecdh_LDKNodeSigner_jcall,
8213                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
8214                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
8215                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
8216                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
8217                 .free = LDKNodeSigner_JCalls_free,
8218         };
8219         return ret;
8220 }
8221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
8222         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
8223         *res_ptr = LDKNodeSigner_init(env, clz, o);
8224         return tag_ptr(res_ptr, true);
8225 }
8226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
8227         void* this_arg_ptr = untag_ptr(this_arg);
8228         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8229         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8230         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8231         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
8232         return ret_arr;
8233 }
8234
8235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
8236         void* this_arg_ptr = untag_ptr(this_arg);
8237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8238         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8239         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8240         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
8241         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
8242         return tag_ptr(ret_conv, true);
8243 }
8244
8245 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) {
8246         void* this_arg_ptr = untag_ptr(this_arg);
8247         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8248         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8249         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8250         LDKPublicKey other_key_ref;
8251         CHECK((*env)->GetArrayLength(env, other_key) == 33);
8252         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
8253         void* tweak_ptr = untag_ptr(tweak);
8254         CHECK_ACCESS(tweak_ptr);
8255         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
8256         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
8257         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
8258         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
8259         return tag_ptr(ret_conv, true);
8260 }
8261
8262 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) {
8263         void* this_arg_ptr = untag_ptr(this_arg);
8264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8265         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8266         LDKu8slice hrp_bytes_ref;
8267         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8268         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8269         LDKCVec_U5Z invoice_data_constr;
8270         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8271         if (invoice_data_constr.datalen > 0)
8272                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8273         else
8274                 invoice_data_constr.data = NULL;
8275         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8276         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8277                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8278                 
8279                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8280         }
8281         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8282         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8283         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8284         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8285         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8286         return tag_ptr(ret_conv, true);
8287 }
8288
8289 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) {
8290         void* this_arg_ptr = untag_ptr(this_arg);
8291         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8292         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8293         LDKUnsignedInvoiceRequest invoice_request_conv;
8294         invoice_request_conv.inner = untag_ptr(invoice_request);
8295         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
8296         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
8297         invoice_request_conv.is_owned = false;
8298         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8299         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
8300         return tag_ptr(ret_conv, true);
8301 }
8302
8303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
8304         void* this_arg_ptr = untag_ptr(this_arg);
8305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8306         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8307         LDKUnsignedBolt12Invoice invoice_conv;
8308         invoice_conv.inner = untag_ptr(invoice);
8309         invoice_conv.is_owned = ptr_is_owned(invoice);
8310         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
8311         invoice_conv.is_owned = false;
8312         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8313         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
8314         return tag_ptr(ret_conv, true);
8315 }
8316
8317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8318         void* this_arg_ptr = untag_ptr(this_arg);
8319         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8320         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8321         void* msg_ptr = untag_ptr(msg);
8322         CHECK_ACCESS(msg_ptr);
8323         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
8324         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
8325         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
8326         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
8327         return tag_ptr(ret_conv, true);
8328 }
8329
8330 typedef struct LDKSignerProvider_JCalls {
8331         atomic_size_t refcnt;
8332         JavaVM *vm;
8333         jweak o;
8334         jmethodID generate_channel_keys_id_meth;
8335         jmethodID derive_channel_signer_meth;
8336         jmethodID read_chan_signer_meth;
8337         jmethodID get_destination_script_meth;
8338         jmethodID get_shutdown_scriptpubkey_meth;
8339 } LDKSignerProvider_JCalls;
8340 static void LDKSignerProvider_JCalls_free(void* this_arg) {
8341         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8342         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8343                 JNIEnv *env;
8344                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8345                 if (get_jenv_res == JNI_EDETACHED) {
8346                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8347                 } else {
8348                         DO_ASSERT(get_jenv_res == JNI_OK);
8349                 }
8350                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8351                 if (get_jenv_res == JNI_EDETACHED) {
8352                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8353                 }
8354                 FREE(j_calls);
8355         }
8356 }
8357 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
8358         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8359         JNIEnv *env;
8360         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8361         if (get_jenv_res == JNI_EDETACHED) {
8362                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8363         } else {
8364                 DO_ASSERT(get_jenv_res == JNI_OK);
8365         }
8366         jboolean inbound_conv = inbound;
8367         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8368         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
8369         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
8370         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8371         CHECK(obj != NULL);
8372         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
8373         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8374                 (*env)->ExceptionDescribe(env);
8375                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
8376         }
8377         LDKThirtyTwoBytes ret_ref;
8378         CHECK((*env)->GetArrayLength(env, ret) == 32);
8379         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8380         if (get_jenv_res == JNI_EDETACHED) {
8381                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8382         }
8383         return ret_ref;
8384 }
8385 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
8386         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8387         JNIEnv *env;
8388         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8389         if (get_jenv_res == JNI_EDETACHED) {
8390                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8391         } else {
8392                 DO_ASSERT(get_jenv_res == JNI_OK);
8393         }
8394         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8395         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
8396         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
8397         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8398         CHECK(obj != NULL);
8399         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
8400         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8401                 (*env)->ExceptionDescribe(env);
8402                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
8403         }
8404         void* ret_ptr = untag_ptr(ret);
8405         CHECK_ACCESS(ret_ptr);
8406         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
8407         FREE(untag_ptr(ret));
8408         if (get_jenv_res == JNI_EDETACHED) {
8409                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8410         }
8411         return ret_conv;
8412 }
8413 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
8414         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8415         JNIEnv *env;
8416         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8417         if (get_jenv_res == JNI_EDETACHED) {
8418                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8419         } else {
8420                 DO_ASSERT(get_jenv_res == JNI_OK);
8421         }
8422         LDKu8slice reader_var = reader;
8423         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8424         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8425         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8426         CHECK(obj != NULL);
8427         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8428         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8429                 (*env)->ExceptionDescribe(env);
8430                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8431         }
8432         void* ret_ptr = untag_ptr(ret);
8433         CHECK_ACCESS(ret_ptr);
8434         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8435         FREE(untag_ptr(ret));
8436         if (get_jenv_res == JNI_EDETACHED) {
8437                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8438         }
8439         return ret_conv;
8440 }
8441 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8442         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8443         JNIEnv *env;
8444         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8445         if (get_jenv_res == JNI_EDETACHED) {
8446                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8447         } else {
8448                 DO_ASSERT(get_jenv_res == JNI_OK);
8449         }
8450         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8451         CHECK(obj != NULL);
8452         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
8453         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8454                 (*env)->ExceptionDescribe(env);
8455                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8456         }
8457         void* ret_ptr = untag_ptr(ret);
8458         CHECK_ACCESS(ret_ptr);
8459         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
8460         FREE(untag_ptr(ret));
8461         if (get_jenv_res == JNI_EDETACHED) {
8462                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8463         }
8464         return ret_conv;
8465 }
8466 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8467         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8468         JNIEnv *env;
8469         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8470         if (get_jenv_res == JNI_EDETACHED) {
8471                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8472         } else {
8473                 DO_ASSERT(get_jenv_res == JNI_OK);
8474         }
8475         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8476         CHECK(obj != NULL);
8477         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8478         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8479                 (*env)->ExceptionDescribe(env);
8480                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8481         }
8482         void* ret_ptr = untag_ptr(ret);
8483         CHECK_ACCESS(ret_ptr);
8484         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
8485         FREE(untag_ptr(ret));
8486         if (get_jenv_res == JNI_EDETACHED) {
8487                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8488         }
8489         return ret_conv;
8490 }
8491 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8492         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8493         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8494 }
8495 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8496         jclass c = (*env)->GetObjectClass(env, o);
8497         CHECK(c != NULL);
8498         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8499         atomic_init(&calls->refcnt, 1);
8500         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8501         calls->o = (*env)->NewWeakGlobalRef(env, o);
8502         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8503         CHECK(calls->generate_channel_keys_id_meth != NULL);
8504         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8505         CHECK(calls->derive_channel_signer_meth != NULL);
8506         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8507         CHECK(calls->read_chan_signer_meth != NULL);
8508         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
8509         CHECK(calls->get_destination_script_meth != NULL);
8510         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8511         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8512
8513         LDKSignerProvider ret = {
8514                 .this_arg = (void*) calls,
8515                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8516                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8517                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8518                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8519                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8520                 .free = LDKSignerProvider_JCalls_free,
8521         };
8522         return ret;
8523 }
8524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8525         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8526         *res_ptr = LDKSignerProvider_init(env, clz, o);
8527         return tag_ptr(res_ptr, true);
8528 }
8529 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) {
8530         void* this_arg_ptr = untag_ptr(this_arg);
8531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8532         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8533         LDKU128 user_channel_id_ref;
8534         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8535         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8536         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8537         (*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);
8538         return ret_arr;
8539 }
8540
8541 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) {
8542         void* this_arg_ptr = untag_ptr(this_arg);
8543         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8544         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8545         LDKThirtyTwoBytes channel_keys_id_ref;
8546         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8547         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8548         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8549         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8550         return tag_ptr(ret_ret, true);
8551 }
8552
8553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8554         void* this_arg_ptr = untag_ptr(this_arg);
8555         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8556         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8557         LDKu8slice reader_ref;
8558         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8559         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8560         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8561         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8562         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8563         return tag_ptr(ret_conv, true);
8564 }
8565
8566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8567         void* this_arg_ptr = untag_ptr(this_arg);
8568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8569         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8570         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
8571         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8572         return tag_ptr(ret_conv, true);
8573 }
8574
8575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8576         void* this_arg_ptr = untag_ptr(this_arg);
8577         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8578         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8579         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
8580         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8581         return tag_ptr(ret_conv, true);
8582 }
8583
8584 typedef struct LDKFeeEstimator_JCalls {
8585         atomic_size_t refcnt;
8586         JavaVM *vm;
8587         jweak o;
8588         jmethodID get_est_sat_per_1000_weight_meth;
8589 } LDKFeeEstimator_JCalls;
8590 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8591         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8592         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8593                 JNIEnv *env;
8594                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8595                 if (get_jenv_res == JNI_EDETACHED) {
8596                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8597                 } else {
8598                         DO_ASSERT(get_jenv_res == JNI_OK);
8599                 }
8600                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8601                 if (get_jenv_res == JNI_EDETACHED) {
8602                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8603                 }
8604                 FREE(j_calls);
8605         }
8606 }
8607 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8608         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8609         JNIEnv *env;
8610         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8611         if (get_jenv_res == JNI_EDETACHED) {
8612                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8613         } else {
8614                 DO_ASSERT(get_jenv_res == JNI_OK);
8615         }
8616         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8617         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8618         CHECK(obj != NULL);
8619         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8620         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8621                 (*env)->ExceptionDescribe(env);
8622                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8623         }
8624         if (get_jenv_res == JNI_EDETACHED) {
8625                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8626         }
8627         return ret;
8628 }
8629 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8630         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8631         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8632 }
8633 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8634         jclass c = (*env)->GetObjectClass(env, o);
8635         CHECK(c != NULL);
8636         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8637         atomic_init(&calls->refcnt, 1);
8638         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8639         calls->o = (*env)->NewWeakGlobalRef(env, o);
8640         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8641         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8642
8643         LDKFeeEstimator ret = {
8644                 .this_arg = (void*) calls,
8645                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8646                 .free = LDKFeeEstimator_JCalls_free,
8647         };
8648         return ret;
8649 }
8650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8651         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8652         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8653         return tag_ptr(res_ptr, true);
8654 }
8655 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) {
8656         void* this_arg_ptr = untag_ptr(this_arg);
8657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8658         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8659         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8660         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8661         return ret_conv;
8662 }
8663
8664 typedef struct LDKRouter_JCalls {
8665         atomic_size_t refcnt;
8666         JavaVM *vm;
8667         jweak o;
8668         jmethodID find_route_meth;
8669         jmethodID find_route_with_id_meth;
8670 } LDKRouter_JCalls;
8671 static void LDKRouter_JCalls_free(void* this_arg) {
8672         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8673         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8674                 JNIEnv *env;
8675                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8676                 if (get_jenv_res == JNI_EDETACHED) {
8677                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8678                 } else {
8679                         DO_ASSERT(get_jenv_res == JNI_OK);
8680                 }
8681                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8682                 if (get_jenv_res == JNI_EDETACHED) {
8683                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8684                 }
8685                 FREE(j_calls);
8686         }
8687 }
8688 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
8689         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8690         JNIEnv *env;
8691         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8692         if (get_jenv_res == JNI_EDETACHED) {
8693                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8694         } else {
8695                 DO_ASSERT(get_jenv_res == JNI_OK);
8696         }
8697         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8698         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8699         LDKRouteParameters route_params_var = *route_params;
8700         int64_t route_params_ref = 0;
8701         route_params_var = RouteParameters_clone(&route_params_var);
8702         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8703         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8704         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8705         int64_tArray first_hops_arr = NULL;
8706         if (first_hops != NULL) {
8707                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8708                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8709                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8710                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8711                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8712                         int64_t first_hops_conv_16_ref = 0;
8713                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8714                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8715                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8716                 }
8717                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8718         }
8719         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8720         int64_t inflight_htlcs_ref = 0;
8721         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8722         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8723         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8724         CHECK(obj != NULL);
8725         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8726         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8727                 (*env)->ExceptionDescribe(env);
8728                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8729         }
8730         void* ret_ptr = untag_ptr(ret);
8731         CHECK_ACCESS(ret_ptr);
8732         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8733         FREE(untag_ptr(ret));
8734         if (get_jenv_res == JNI_EDETACHED) {
8735                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8736         }
8737         return ret_conv;
8738 }
8739 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) {
8740         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8741         JNIEnv *env;
8742         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8743         if (get_jenv_res == JNI_EDETACHED) {
8744                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8745         } else {
8746                 DO_ASSERT(get_jenv_res == JNI_OK);
8747         }
8748         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8749         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8750         LDKRouteParameters route_params_var = *route_params;
8751         int64_t route_params_ref = 0;
8752         route_params_var = RouteParameters_clone(&route_params_var);
8753         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8754         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8755         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8756         int64_tArray first_hops_arr = NULL;
8757         if (first_hops != NULL) {
8758                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8759                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8760                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8761                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8762                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8763                         int64_t first_hops_conv_16_ref = 0;
8764                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8765                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8766                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8767                 }
8768                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8769         }
8770         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8771         int64_t inflight_htlcs_ref = 0;
8772         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8773         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8774         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
8775         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
8776         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
8777         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
8778         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8779         CHECK(obj != NULL);
8780         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);
8781         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8782                 (*env)->ExceptionDescribe(env);
8783                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
8784         }
8785         void* ret_ptr = untag_ptr(ret);
8786         CHECK_ACCESS(ret_ptr);
8787         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8788         FREE(untag_ptr(ret));
8789         if (get_jenv_res == JNI_EDETACHED) {
8790                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8791         }
8792         return ret_conv;
8793 }
8794 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8795         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8796         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8797 }
8798 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
8799         jclass c = (*env)->GetObjectClass(env, o);
8800         CHECK(c != NULL);
8801         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8802         atomic_init(&calls->refcnt, 1);
8803         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8804         calls->o = (*env)->NewWeakGlobalRef(env, o);
8805         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
8806         CHECK(calls->find_route_meth != NULL);
8807         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
8808         CHECK(calls->find_route_with_id_meth != NULL);
8809
8810         LDKRouter ret = {
8811                 .this_arg = (void*) calls,
8812                 .find_route = find_route_LDKRouter_jcall,
8813                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
8814                 .free = LDKRouter_JCalls_free,
8815         };
8816         return ret;
8817 }
8818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
8819         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8820         *res_ptr = LDKRouter_init(env, clz, o);
8821         return tag_ptr(res_ptr, true);
8822 }
8823 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) {
8824         void* this_arg_ptr = untag_ptr(this_arg);
8825         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8826         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8827         LDKPublicKey payer_ref;
8828         CHECK((*env)->GetArrayLength(env, payer) == 33);
8829         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8830         LDKRouteParameters route_params_conv;
8831         route_params_conv.inner = untag_ptr(route_params);
8832         route_params_conv.is_owned = ptr_is_owned(route_params);
8833         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8834         route_params_conv.is_owned = false;
8835         LDKCVec_ChannelDetailsZ first_hops_constr;
8836         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8837         if (first_hops != NULL) {
8838                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8839                 if (first_hops_constr.datalen > 0)
8840                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8841                 else
8842                         first_hops_constr.data = NULL;
8843                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8844                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8845                         int64_t first_hops_conv_16 = first_hops_vals[q];
8846                         LDKChannelDetails first_hops_conv_16_conv;
8847                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8848                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8849                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8850                         first_hops_conv_16_conv.is_owned = false;
8851                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8852                 }
8853                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8854                 first_hops_ptr = &first_hops_constr;
8855         }
8856         LDKInFlightHtlcs inflight_htlcs_conv;
8857         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8858         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8859         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8860         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8861         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8862         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
8863         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8864         return tag_ptr(ret_conv, true);
8865 }
8866
8867 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) {
8868         void* this_arg_ptr = untag_ptr(this_arg);
8869         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8870         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8871         LDKPublicKey payer_ref;
8872         CHECK((*env)->GetArrayLength(env, payer) == 33);
8873         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8874         LDKRouteParameters route_params_conv;
8875         route_params_conv.inner = untag_ptr(route_params);
8876         route_params_conv.is_owned = ptr_is_owned(route_params);
8877         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8878         route_params_conv.is_owned = false;
8879         LDKCVec_ChannelDetailsZ first_hops_constr;
8880         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8881         if (first_hops != NULL) {
8882                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8883                 if (first_hops_constr.datalen > 0)
8884                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8885                 else
8886                         first_hops_constr.data = NULL;
8887                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8888                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8889                         int64_t first_hops_conv_16 = first_hops_vals[q];
8890                         LDKChannelDetails first_hops_conv_16_conv;
8891                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8892                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8893                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8894                         first_hops_conv_16_conv.is_owned = false;
8895                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8896                 }
8897                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8898                 first_hops_ptr = &first_hops_constr;
8899         }
8900         LDKInFlightHtlcs inflight_htlcs_conv;
8901         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8902         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8903         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8904         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8905         LDKThirtyTwoBytes _payment_hash_ref;
8906         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
8907         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
8908         LDKThirtyTwoBytes _payment_id_ref;
8909         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
8910         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
8911         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8912         *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);
8913         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8914         return tag_ptr(ret_conv, true);
8915 }
8916
8917 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
8918         return ThirtyTwoBytes_clone(&owner->a);
8919 }
8920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8921         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
8922         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
8924         return ret_arr;
8925 }
8926
8927 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
8928         LDKChannelManager ret = owner->b;
8929         ret.is_owned = false;
8930         return ret;
8931 }
8932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8933         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
8934         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
8935         int64_t ret_ref = 0;
8936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8938         return ret_ref;
8939 }
8940
8941 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8942 CHECK(owner->result_ok);
8943         return &*owner->contents.result;
8944 }
8945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8946         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8947         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
8948         return ret_ret;
8949 }
8950
8951 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8952 CHECK(!owner->result_ok);
8953         return DecodeError_clone(&*owner->contents.err);
8954 }
8955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8956         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8958         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
8959         int64_t ret_ref = tag_ptr(ret_copy, true);
8960         return ret_ref;
8961 }
8962
8963 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
8964 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
8965 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
8966 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
8967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
8968         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
8969                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
8970         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
8971         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
8972         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
8973         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
8974                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
8975         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
8976         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
8977         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
8978 }
8979 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8980         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8981         switch(obj->tag) {
8982                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
8983                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
8984                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
8985                 }
8986                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
8987                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
8988                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
8989                 }
8990                 default: abort();
8991         }
8992 }
8993 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8994 CHECK(owner->result_ok);
8995         return MaxDustHTLCExposure_clone(&*owner->contents.result);
8996 }
8997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8998         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8999         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
9000         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
9001         int64_t ret_ref = tag_ptr(ret_copy, true);
9002         return ret_ref;
9003 }
9004
9005 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9006 CHECK(!owner->result_ok);
9007         return DecodeError_clone(&*owner->contents.err);
9008 }
9009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9010         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9012         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
9013         int64_t ret_ref = tag_ptr(ret_copy, true);
9014         return ret_ref;
9015 }
9016
9017 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9018         LDKChannelConfig ret = *owner->contents.result;
9019         ret.is_owned = false;
9020         return ret;
9021 }
9022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9023         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9024         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
9025         int64_t ret_ref = 0;
9026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9028         return ret_ref;
9029 }
9030
9031 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9032 CHECK(!owner->result_ok);
9033         return DecodeError_clone(&*owner->contents.err);
9034 }
9035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9036         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9038         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
9039         int64_t ret_ref = tag_ptr(ret_copy, true);
9040         return ret_ref;
9041 }
9042
9043 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
9044 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
9045 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
9046 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
9047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
9048         LDKCOption_MaxDustHTLCExposureZ_Some_class =
9049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
9050         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
9051         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
9052         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
9053         LDKCOption_MaxDustHTLCExposureZ_None_class =
9054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
9055         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
9056         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
9057         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
9058 }
9059 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9060         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
9061         switch(obj->tag) {
9062                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
9063                         int64_t some_ref = tag_ptr(&obj->some, false);
9064                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
9065                 }
9066                 case LDKCOption_MaxDustHTLCExposureZ_None: {
9067                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
9068                 }
9069                 default: abort();
9070         }
9071 }
9072 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
9073 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
9074 static jclass LDKCOption_APIErrorZ_None_class = NULL;
9075 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
9076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
9077         LDKCOption_APIErrorZ_Some_class =
9078                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
9079         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
9080         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
9081         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
9082         LDKCOption_APIErrorZ_None_class =
9083                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
9084         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
9085         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
9086         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
9087 }
9088 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9089         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
9090         switch(obj->tag) {
9091                 case LDKCOption_APIErrorZ_Some: {
9092                         int64_t some_ref = tag_ptr(&obj->some, false);
9093                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
9094                 }
9095                 case LDKCOption_APIErrorZ_None: {
9096                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
9097                 }
9098                 default: abort();
9099         }
9100 }
9101 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9102 CHECK(owner->result_ok);
9103         return COption_APIErrorZ_clone(&*owner->contents.result);
9104 }
9105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9106         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9107         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
9108         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
9109         int64_t ret_ref = tag_ptr(ret_copy, true);
9110         return ret_ref;
9111 }
9112
9113 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9114 CHECK(!owner->result_ok);
9115         return DecodeError_clone(&*owner->contents.err);
9116 }
9117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9118         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9119         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9120         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
9121         int64_t ret_ref = tag_ptr(ret_copy, true);
9122         return ret_ref;
9123 }
9124
9125 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9126         LDKChannelMonitorUpdate ret = *owner->contents.result;
9127         ret.is_owned = false;
9128         return ret;
9129 }
9130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9131         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9132         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
9133         int64_t ret_ref = 0;
9134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9136         return ret_ref;
9137 }
9138
9139 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9140 CHECK(!owner->result_ok);
9141         return DecodeError_clone(&*owner->contents.err);
9142 }
9143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9144         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9145         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9146         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
9147         int64_t ret_ref = tag_ptr(ret_copy, true);
9148         return ret_ref;
9149 }
9150
9151 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
9152 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
9153 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
9154 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
9155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
9156         LDKCOption_MonitorEventZ_Some_class =
9157                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
9158         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
9159         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
9160         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
9161         LDKCOption_MonitorEventZ_None_class =
9162                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
9163         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
9164         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
9165         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
9166 }
9167 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9168         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
9169         switch(obj->tag) {
9170                 case LDKCOption_MonitorEventZ_Some: {
9171                         int64_t some_ref = tag_ptr(&obj->some, false);
9172                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
9173                 }
9174                 case LDKCOption_MonitorEventZ_None: {
9175                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
9176                 }
9177                 default: abort();
9178         }
9179 }
9180 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9181 CHECK(owner->result_ok);
9182         return COption_MonitorEventZ_clone(&*owner->contents.result);
9183 }
9184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9185         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9186         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9187         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
9188         int64_t ret_ref = tag_ptr(ret_copy, true);
9189         return ret_ref;
9190 }
9191
9192 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9193 CHECK(!owner->result_ok);
9194         return DecodeError_clone(&*owner->contents.err);
9195 }
9196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9197         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9198         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9199         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
9200         int64_t ret_ref = tag_ptr(ret_copy, true);
9201         return ret_ref;
9202 }
9203
9204 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9205         LDKHTLCUpdate ret = *owner->contents.result;
9206         ret.is_owned = false;
9207         return ret;
9208 }
9209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9210         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9211         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
9212         int64_t ret_ref = 0;
9213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9215         return ret_ref;
9216 }
9217
9218 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9219 CHECK(!owner->result_ok);
9220         return DecodeError_clone(&*owner->contents.err);
9221 }
9222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9223         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9224         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9225         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
9226         int64_t ret_ref = tag_ptr(ret_copy, true);
9227         return ret_ref;
9228 }
9229
9230 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9231         LDKOutPoint ret = owner->a;
9232         ret.is_owned = false;
9233         return ret;
9234 }
9235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9236         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9237         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
9238         int64_t ret_ref = 0;
9239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9241         return ret_ref;
9242 }
9243
9244 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9245         return CVec_u8Z_clone(&owner->b);
9246 }
9247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9248         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9249         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
9250         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9251         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9252         CVec_u8Z_free(ret_var);
9253         return ret_arr;
9254 }
9255
9256 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9257         return owner->a;
9258 }
9259 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9260         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9261         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
9262         return ret_conv;
9263 }
9264
9265 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9266         return CVec_u8Z_clone(&owner->b);
9267 }
9268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9269         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9270         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
9271         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9272         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9273         CVec_u8Z_free(ret_var);
9274         return ret_arr;
9275 }
9276
9277 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
9278         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
9279         for (size_t i = 0; i < ret.datalen; i++) {
9280                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
9281         }
9282         return ret;
9283 }
9284 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9285         return ThirtyTwoBytes_clone(&owner->a);
9286 }
9287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9288         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9289         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9290         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
9291         return ret_arr;
9292 }
9293
9294 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9295         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
9296 }
9297 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9298         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9299         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
9300         int64_tArray ret_arr = NULL;
9301         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9302         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9303         for (size_t x = 0; x < ret_var.datalen; x++) {
9304                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
9305                 *ret_conv_23_conv = ret_var.data[x];
9306                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
9307         }
9308         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9309         FREE(ret_var.data);
9310         return ret_arr;
9311 }
9312
9313 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
9314         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 };
9315         for (size_t i = 0; i < ret.datalen; i++) {
9316                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
9317         }
9318         return ret;
9319 }
9320 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
9321         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
9322         for (size_t i = 0; i < ret.datalen; i++) {
9323                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
9324         }
9325         return ret;
9326 }
9327 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9328         return owner->a;
9329 }
9330 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9331         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9332         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
9333         return ret_conv;
9334 }
9335
9336 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9337         return TxOut_clone(&owner->b);
9338 }
9339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9340         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9341         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9342         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
9343         return tag_ptr(ret_ref, true);
9344 }
9345
9346 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
9347         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
9348         for (size_t i = 0; i < ret.datalen; i++) {
9349                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
9350         }
9351         return ret;
9352 }
9353 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9354         return ThirtyTwoBytes_clone(&owner->a);
9355 }
9356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9357         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9358         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9359         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
9360         return ret_arr;
9361 }
9362
9363 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9364         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
9365 }
9366 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9367         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9368         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
9369         int64_tArray ret_arr = NULL;
9370         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9371         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9372         for (size_t u = 0; u < ret_var.datalen; u++) {
9373                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9374                 *ret_conv_20_conv = ret_var.data[u];
9375                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
9376         }
9377         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9378         FREE(ret_var.data);
9379         return ret_arr;
9380 }
9381
9382 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
9383         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 };
9384         for (size_t i = 0; i < ret.datalen; i++) {
9385                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
9386         }
9387         return ret;
9388 }
9389 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
9390 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
9391 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
9392 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
9393 static jclass LDKBalance_ContentiousClaimable_class = NULL;
9394 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
9395 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
9396 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
9397 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
9398 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
9399 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
9400 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
9401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
9402         LDKBalance_ClaimableOnChannelClose_class =
9403                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
9404         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
9405         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
9406         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
9407         LDKBalance_ClaimableAwaitingConfirmations_class =
9408                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
9409         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
9410         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
9411         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
9412         LDKBalance_ContentiousClaimable_class =
9413                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
9414         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
9415         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
9416         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
9417         LDKBalance_MaybeTimeoutClaimableHTLC_class =
9418                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
9419         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
9420         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
9421         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9422         LDKBalance_MaybePreimageClaimableHTLC_class =
9423                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9424         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9425         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
9426         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9427         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9428                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9429         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9430         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9431         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9432 }
9433 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9434         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9435         switch(obj->tag) {
9436                 case LDKBalance_ClaimableOnChannelClose: {
9437                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
9438                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
9439                 }
9440                 case LDKBalance_ClaimableAwaitingConfirmations: {
9441                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
9442                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9443                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
9444                 }
9445                 case LDKBalance_ContentiousClaimable: {
9446                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
9447                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9448                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9449                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
9450                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
9451                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
9452                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
9453                 }
9454                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9455                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
9456                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9457                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9458                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
9459                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
9460                 }
9461                 case LDKBalance_MaybePreimageClaimableHTLC: {
9462                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
9463                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9464                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9465                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
9466                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
9467                 }
9468                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9469                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
9470                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
9471                 }
9472                 default: abort();
9473         }
9474 }
9475 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9476         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9477         for (size_t i = 0; i < ret.datalen; i++) {
9478                 ret.data[i] = Balance_clone(&orig->data[i]);
9479         }
9480         return ret;
9481 }
9482 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9483         return ThirtyTwoBytes_clone(&owner->a);
9484 }
9485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9486         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9487         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9488         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
9489         return ret_arr;
9490 }
9491
9492 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9493         LDKChannelMonitor ret = owner->b;
9494         ret.is_owned = false;
9495         return ret;
9496 }
9497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9498         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9499         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
9500         int64_t ret_ref = 0;
9501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9503         return ret_ref;
9504 }
9505
9506 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9507 CHECK(owner->result_ok);
9508         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
9509 }
9510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9511         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9512         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9513         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9514         return tag_ptr(ret_conv, true);
9515 }
9516
9517 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9518 CHECK(!owner->result_ok);
9519         return DecodeError_clone(&*owner->contents.err);
9520 }
9521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9522         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9523         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9524         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9525         int64_t ret_ref = tag_ptr(ret_copy, true);
9526         return ret_ref;
9527 }
9528
9529 typedef struct LDKType_JCalls {
9530         atomic_size_t refcnt;
9531         JavaVM *vm;
9532         jweak o;
9533         jmethodID type_id_meth;
9534         jmethodID debug_str_meth;
9535         jmethodID write_meth;
9536 } LDKType_JCalls;
9537 static void LDKType_JCalls_free(void* this_arg) {
9538         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9539         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9540                 JNIEnv *env;
9541                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9542                 if (get_jenv_res == JNI_EDETACHED) {
9543                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9544                 } else {
9545                         DO_ASSERT(get_jenv_res == JNI_OK);
9546                 }
9547                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9548                 if (get_jenv_res == JNI_EDETACHED) {
9549                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9550                 }
9551                 FREE(j_calls);
9552         }
9553 }
9554 uint16_t type_id_LDKType_jcall(const void* this_arg) {
9555         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9556         JNIEnv *env;
9557         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9558         if (get_jenv_res == JNI_EDETACHED) {
9559                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9560         } else {
9561                 DO_ASSERT(get_jenv_res == JNI_OK);
9562         }
9563         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9564         CHECK(obj != NULL);
9565         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
9566         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9567                 (*env)->ExceptionDescribe(env);
9568                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
9569         }
9570         if (get_jenv_res == JNI_EDETACHED) {
9571                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9572         }
9573         return ret;
9574 }
9575 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
9576         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9577         JNIEnv *env;
9578         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9579         if (get_jenv_res == JNI_EDETACHED) {
9580                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9581         } else {
9582                 DO_ASSERT(get_jenv_res == JNI_OK);
9583         }
9584         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9585         CHECK(obj != NULL);
9586         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
9587         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9588                 (*env)->ExceptionDescribe(env);
9589                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
9590         }
9591         LDKStr ret_conv = java_to_owned_str(env, ret);
9592         if (get_jenv_res == JNI_EDETACHED) {
9593                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9594         }
9595         return ret_conv;
9596 }
9597 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
9598         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9599         JNIEnv *env;
9600         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9601         if (get_jenv_res == JNI_EDETACHED) {
9602                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9603         } else {
9604                 DO_ASSERT(get_jenv_res == JNI_OK);
9605         }
9606         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9607         CHECK(obj != NULL);
9608         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9609         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9610                 (*env)->ExceptionDescribe(env);
9611                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
9612         }
9613         LDKCVec_u8Z ret_ref;
9614         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9615         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9616         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9617         if (get_jenv_res == JNI_EDETACHED) {
9618                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9619         }
9620         return ret_ref;
9621 }
9622 static void LDKType_JCalls_cloned(LDKType* new_obj) {
9623         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
9624         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9625 }
9626 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
9627         jclass c = (*env)->GetObjectClass(env, o);
9628         CHECK(c != NULL);
9629         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
9630         atomic_init(&calls->refcnt, 1);
9631         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9632         calls->o = (*env)->NewWeakGlobalRef(env, o);
9633         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
9634         CHECK(calls->type_id_meth != NULL);
9635         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
9636         CHECK(calls->debug_str_meth != NULL);
9637         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9638         CHECK(calls->write_meth != NULL);
9639
9640         LDKType ret = {
9641                 .this_arg = (void*) calls,
9642                 .type_id = type_id_LDKType_jcall,
9643                 .debug_str = debug_str_LDKType_jcall,
9644                 .write = write_LDKType_jcall,
9645                 .cloned = LDKType_JCalls_cloned,
9646                 .free = LDKType_JCalls_free,
9647         };
9648         return ret;
9649 }
9650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
9651         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
9652         *res_ptr = LDKType_init(env, clz, o);
9653         return tag_ptr(res_ptr, true);
9654 }
9655 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9656         void* this_arg_ptr = untag_ptr(this_arg);
9657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9658         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9659         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
9660         return ret_conv;
9661 }
9662
9663 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
9664         void* this_arg_ptr = untag_ptr(this_arg);
9665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9666         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9667         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
9668         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9669         Str_free(ret_str);
9670         return ret_conv;
9671 }
9672
9673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9674         void* this_arg_ptr = untag_ptr(this_arg);
9675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9676         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9677         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9680         CVec_u8Z_free(ret_var);
9681         return ret_arr;
9682 }
9683
9684 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9685         return owner->a;
9686 }
9687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9688         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9689         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9690         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9691         return ret_arr;
9692 }
9693
9694 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9695         return Type_clone(&owner->b);
9696 }
9697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9698         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9699         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9700         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9701         return tag_ptr(ret_ret, true);
9702 }
9703
9704 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9705         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9706         for (size_t i = 0; i < ret.datalen; i++) {
9707                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9708         }
9709         return ret;
9710 }
9711 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
9712 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
9713 static jclass LDKOffersMessage_Invoice_class = NULL;
9714 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
9715 static jclass LDKOffersMessage_InvoiceError_class = NULL;
9716 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
9717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
9718         LDKOffersMessage_InvoiceRequest_class =
9719                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
9720         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
9721         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
9722         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
9723         LDKOffersMessage_Invoice_class =
9724                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
9725         CHECK(LDKOffersMessage_Invoice_class != NULL);
9726         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
9727         CHECK(LDKOffersMessage_Invoice_meth != NULL);
9728         LDKOffersMessage_InvoiceError_class =
9729                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
9730         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
9731         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
9732         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
9733 }
9734 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9735         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
9736         switch(obj->tag) {
9737                 case LDKOffersMessage_InvoiceRequest: {
9738                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
9739                         int64_t invoice_request_ref = 0;
9740                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9741                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
9742                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
9743                 }
9744                 case LDKOffersMessage_Invoice: {
9745                         LDKBolt12Invoice invoice_var = obj->invoice;
9746                         int64_t invoice_ref = 0;
9747                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9748                         invoice_ref = tag_ptr(invoice_var.inner, false);
9749                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
9750                 }
9751                 case LDKOffersMessage_InvoiceError: {
9752                         LDKInvoiceError invoice_error_var = obj->invoice_error;
9753                         int64_t invoice_error_ref = 0;
9754                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
9755                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
9756                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
9757                 }
9758                 default: abort();
9759         }
9760 }
9761 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
9762 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
9763 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
9764 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
9765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
9766         LDKCOption_OffersMessageZ_Some_class =
9767                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
9768         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
9769         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
9770         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
9771         LDKCOption_OffersMessageZ_None_class =
9772                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
9773         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
9774         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
9775         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
9776 }
9777 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9778         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
9779         switch(obj->tag) {
9780                 case LDKCOption_OffersMessageZ_Some: {
9781                         int64_t some_ref = tag_ptr(&obj->some, false);
9782                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
9783                 }
9784                 case LDKCOption_OffersMessageZ_None: {
9785                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
9786                 }
9787                 default: abort();
9788         }
9789 }
9790 typedef struct LDKCustomOnionMessageContents_JCalls {
9791         atomic_size_t refcnt;
9792         JavaVM *vm;
9793         jweak o;
9794         jmethodID tlv_type_meth;
9795         jmethodID write_meth;
9796 } LDKCustomOnionMessageContents_JCalls;
9797 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
9798         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9799         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9800                 JNIEnv *env;
9801                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9802                 if (get_jenv_res == JNI_EDETACHED) {
9803                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9804                 } else {
9805                         DO_ASSERT(get_jenv_res == JNI_OK);
9806                 }
9807                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9808                 if (get_jenv_res == JNI_EDETACHED) {
9809                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9810                 }
9811                 FREE(j_calls);
9812         }
9813 }
9814 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9815         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9816         JNIEnv *env;
9817         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9818         if (get_jenv_res == JNI_EDETACHED) {
9819                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9820         } else {
9821                 DO_ASSERT(get_jenv_res == JNI_OK);
9822         }
9823         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9824         CHECK(obj != NULL);
9825         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9826         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9827                 (*env)->ExceptionDescribe(env);
9828                 (*env)->FatalError(env, "A call to tlv_type in LDKCustomOnionMessageContents from rust threw an exception.");
9829         }
9830         if (get_jenv_res == JNI_EDETACHED) {
9831                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9832         }
9833         return ret;
9834 }
9835 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9836         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9837         JNIEnv *env;
9838         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9839         if (get_jenv_res == JNI_EDETACHED) {
9840                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9841         } else {
9842                 DO_ASSERT(get_jenv_res == JNI_OK);
9843         }
9844         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9845         CHECK(obj != NULL);
9846         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9847         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9848                 (*env)->ExceptionDescribe(env);
9849                 (*env)->FatalError(env, "A call to write in LDKCustomOnionMessageContents from rust threw an exception.");
9850         }
9851         LDKCVec_u8Z ret_ref;
9852         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9853         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9854         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9855         if (get_jenv_res == JNI_EDETACHED) {
9856                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9857         }
9858         return ret_ref;
9859 }
9860 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
9861         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
9862         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9863 }
9864 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
9865         jclass c = (*env)->GetObjectClass(env, o);
9866         CHECK(c != NULL);
9867         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
9868         atomic_init(&calls->refcnt, 1);
9869         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9870         calls->o = (*env)->NewWeakGlobalRef(env, o);
9871         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
9872         CHECK(calls->tlv_type_meth != NULL);
9873         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9874         CHECK(calls->write_meth != NULL);
9875
9876         LDKCustomOnionMessageContents ret = {
9877                 .this_arg = (void*) calls,
9878                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
9879                 .write = write_LDKCustomOnionMessageContents_jcall,
9880                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
9881                 .free = LDKCustomOnionMessageContents_JCalls_free,
9882         };
9883         return ret;
9884 }
9885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
9886         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9887         *res_ptr = LDKCustomOnionMessageContents_init(env, clz, o);
9888         return tag_ptr(res_ptr, true);
9889 }
9890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
9891         void* this_arg_ptr = untag_ptr(this_arg);
9892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9893         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9894         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
9895         return ret_conv;
9896 }
9897
9898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9899         void* this_arg_ptr = untag_ptr(this_arg);
9900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9901         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9902         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9903         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9904         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9905         CVec_u8Z_free(ret_var);
9906         return ret_arr;
9907 }
9908
9909 static jclass LDKCOption_CustomOnionMessageContentsZ_Some_class = NULL;
9910 static jmethodID LDKCOption_CustomOnionMessageContentsZ_Some_meth = NULL;
9911 static jclass LDKCOption_CustomOnionMessageContentsZ_None_class = NULL;
9912 static jmethodID LDKCOption_CustomOnionMessageContentsZ_None_meth = NULL;
9913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
9914         LDKCOption_CustomOnionMessageContentsZ_Some_class =
9915                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$Some"));
9916         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_class != NULL);
9917         LDKCOption_CustomOnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, "<init>", "(J)V");
9918         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_meth != NULL);
9919         LDKCOption_CustomOnionMessageContentsZ_None_class =
9920                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$None"));
9921         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_class != NULL);
9922         LDKCOption_CustomOnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_None_class, "<init>", "()V");
9923         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_meth != NULL);
9924 }
9925 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9926         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
9927         switch(obj->tag) {
9928                 case LDKCOption_CustomOnionMessageContentsZ_Some: {
9929                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9930                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
9931                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, LDKCOption_CustomOnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
9932                 }
9933                 case LDKCOption_CustomOnionMessageContentsZ_None: {
9934                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_None_class, LDKCOption_CustomOnionMessageContentsZ_None_meth);
9935                 }
9936                 default: abort();
9937         }
9938 }
9939 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9940 CHECK(owner->result_ok);
9941         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
9942 }
9943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9944         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9945         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
9946         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
9947         int64_t ret_ref = tag_ptr(ret_copy, true);
9948         return ret_ref;
9949 }
9950
9951 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9952 CHECK(!owner->result_ok);
9953         return DecodeError_clone(&*owner->contents.err);
9954 }
9955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9956         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9958         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
9959         int64_t ret_ref = tag_ptr(ret_copy, true);
9960         return ret_ref;
9961 }
9962
9963 static jclass LDKCOption_TypeZ_Some_class = NULL;
9964 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
9965 static jclass LDKCOption_TypeZ_None_class = NULL;
9966 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
9967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
9968         LDKCOption_TypeZ_Some_class =
9969                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
9970         CHECK(LDKCOption_TypeZ_Some_class != NULL);
9971         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
9972         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
9973         LDKCOption_TypeZ_None_class =
9974                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
9975         CHECK(LDKCOption_TypeZ_None_class != NULL);
9976         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
9977         CHECK(LDKCOption_TypeZ_None_meth != NULL);
9978 }
9979 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9980         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
9981         switch(obj->tag) {
9982                 case LDKCOption_TypeZ_Some: {
9983                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
9984                         *some_ret = Type_clone(&obj->some);
9985                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
9986                 }
9987                 case LDKCOption_TypeZ_None: {
9988                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
9989                 }
9990                 default: abort();
9991         }
9992 }
9993 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
9994 CHECK(owner->result_ok);
9995         return COption_TypeZ_clone(&*owner->contents.result);
9996 }
9997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9998         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
9999         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10000         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
10001         int64_t ret_ref = tag_ptr(ret_copy, true);
10002         return ret_ref;
10003 }
10004
10005 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10006 CHECK(!owner->result_ok);
10007         return DecodeError_clone(&*owner->contents.err);
10008 }
10009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10010         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10012         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
10013         int64_t ret_ref = tag_ptr(ret_copy, true);
10014         return ret_ref;
10015 }
10016
10017 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
10018 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
10019 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
10020 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
10021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
10022         LDKCOption_SocketAddressZ_Some_class =
10023                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
10024         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
10025         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
10026         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
10027         LDKCOption_SocketAddressZ_None_class =
10028                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
10029         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
10030         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
10031         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
10032 }
10033 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10034         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
10035         switch(obj->tag) {
10036                 case LDKCOption_SocketAddressZ_Some: {
10037                         int64_t some_ref = tag_ptr(&obj->some, false);
10038                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
10039                 }
10040                 case LDKCOption_SocketAddressZ_None: {
10041                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
10042                 }
10043                 default: abort();
10044         }
10045 }
10046 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10047         return owner->a;
10048 }
10049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10050         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10051         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10052         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form);
10053         return ret_arr;
10054 }
10055
10056 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10057         return COption_SocketAddressZ_clone(&owner->b);
10058 }
10059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10060         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10061         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
10062         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
10063         int64_t ret_ref = tag_ptr(ret_copy, true);
10064         return ret_ref;
10065 }
10066
10067 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
10068         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
10069         for (size_t i = 0; i < ret.datalen; i++) {
10070                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
10071         }
10072         return ret;
10073 }
10074 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10075 CHECK(owner->result_ok);
10076         return CVec_u8Z_clone(&*owner->contents.result);
10077 }
10078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10079         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10080         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
10081         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10082         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10083         CVec_u8Z_free(ret_var);
10084         return ret_arr;
10085 }
10086
10087 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10088         LDKPeerHandleError ret = *owner->contents.err;
10089         ret.is_owned = false;
10090         return ret;
10091 }
10092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10093         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10094         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
10095         int64_t ret_ref = 0;
10096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10098         return ret_ref;
10099 }
10100
10101 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10102 CHECK(owner->result_ok);
10103         return *owner->contents.result;
10104 }
10105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10106         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10107         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
10108 }
10109
10110 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10111         LDKPeerHandleError ret = *owner->contents.err;
10112         ret.is_owned = false;
10113         return ret;
10114 }
10115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10116         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10117         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
10118         int64_t ret_ref = 0;
10119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10121         return ret_ref;
10122 }
10123
10124 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10125 CHECK(owner->result_ok);
10126         return *owner->contents.result;
10127 }
10128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10129         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10130         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
10131         return ret_conv;
10132 }
10133
10134 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10135         LDKPeerHandleError ret = *owner->contents.err;
10136         ret.is_owned = false;
10137         return ret;
10138 }
10139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10140         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10141         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
10142         int64_t ret_ref = 0;
10143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10145         return ret_ref;
10146 }
10147
10148 static jclass LDKGraphSyncError_DecodeError_class = NULL;
10149 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
10150 static jclass LDKGraphSyncError_LightningError_class = NULL;
10151 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
10152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
10153         LDKGraphSyncError_DecodeError_class =
10154                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
10155         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
10156         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
10157         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
10158         LDKGraphSyncError_LightningError_class =
10159                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
10160         CHECK(LDKGraphSyncError_LightningError_class != NULL);
10161         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
10162         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
10163 }
10164 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10165         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
10166         switch(obj->tag) {
10167                 case LDKGraphSyncError_DecodeError: {
10168                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
10169                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
10170                 }
10171                 case LDKGraphSyncError_LightningError: {
10172                         LDKLightningError lightning_error_var = obj->lightning_error;
10173                         int64_t lightning_error_ref = 0;
10174                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
10175                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
10176                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
10177                 }
10178                 default: abort();
10179         }
10180 }
10181 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10182 CHECK(owner->result_ok);
10183         return *owner->contents.result;
10184 }
10185 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10186         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10187         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
10188         return ret_conv;
10189 }
10190
10191 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10192 CHECK(!owner->result_ok);
10193         return GraphSyncError_clone(&*owner->contents.err);
10194 }
10195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10196         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10197         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
10198         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
10199         int64_t ret_ref = tag_ptr(ret_copy, true);
10200         return ret_ref;
10201 }
10202
10203 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10204 CHECK(owner->result_ok);
10205         return CVec_u8Z_clone(&*owner->contents.result);
10206 }
10207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10208         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10209         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
10210         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10211         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10212         CVec_u8Z_free(ret_var);
10213         return ret_arr;
10214 }
10215
10216 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10217 CHECK(!owner->result_ok);
10218         return *owner->contents.err;
10219 }
10220 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10221         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10222         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
10223         return ret_conv;
10224 }
10225
10226 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10227 CHECK(owner->result_ok);
10228         return *owner->contents.result;
10229 }
10230 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10231         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10232         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
10233         jobjectArray ret_arr = NULL;
10234         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
10235         ;
10236         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10237         for (size_t i = 0; i < ret_var.datalen; i++) {
10238                 LDKStr ret_conv_8_str = ret_var.data[i];
10239                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
10240                 ret_arr_ptr[i] = ret_conv_8_conv;
10241         }
10242         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10243         return ret_arr;
10244 }
10245
10246 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10247 CHECK(!owner->result_ok);
10248         return *owner->contents.err;
10249 }
10250 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10251         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10252         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
10253         return ret_conv;
10254 }
10255
10256 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
10257         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
10258         for (size_t i = 0; i < ret.datalen; i++) {
10259                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
10260         }
10261         return ret;
10262 }
10263 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10264 CHECK(owner->result_ok);
10265         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
10266 }
10267 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10268         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10269         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
10270         int64_tArray ret_arr = NULL;
10271         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10272         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10273         for (size_t o = 0; o < ret_var.datalen; o++) {
10274                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10275                 *ret_conv_40_conv = ret_var.data[o];
10276                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10277         }
10278         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10279         FREE(ret_var.data);
10280         return ret_arr;
10281 }
10282
10283 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10284 CHECK(!owner->result_ok);
10285         return *owner->contents.err;
10286 }
10287 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10288         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10289         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
10290         return ret_conv;
10291 }
10292
10293 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10294 CHECK(owner->result_ok);
10295         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
10296 }
10297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10298         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10299         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10300         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
10301         return tag_ptr(ret_conv, true);
10302 }
10303
10304 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10305 CHECK(!owner->result_ok);
10306         return *owner->contents.err;
10307 }
10308 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10309         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10310         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
10311         return ret_conv;
10312 }
10313
10314 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
10315 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
10316 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
10317 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
10318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
10319         LDKCOption_SecretKeyZ_Some_class =
10320                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
10321         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
10322         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
10323         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
10324         LDKCOption_SecretKeyZ_None_class =
10325                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
10326         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
10327         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
10328         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
10329 }
10330 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10331         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
10332         switch(obj->tag) {
10333                 case LDKCOption_SecretKeyZ_Some: {
10334                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
10335                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
10336                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
10337                 }
10338                 case LDKCOption_SecretKeyZ_None: {
10339                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
10340                 }
10341                 default: abort();
10342         }
10343 }
10344 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10345         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
10346         ret.is_owned = false;
10347         return ret;
10348 }
10349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10350         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10351         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
10352         int64_t ret_ref = 0;
10353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10355         return ret_ref;
10356 }
10357
10358 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10359 CHECK(!owner->result_ok);
10360         return *owner->contents.err;
10361 }
10362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10363         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10364         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
10365 }
10366
10367 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
10368         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
10369         for (size_t i = 0; i < ret.datalen; i++) {
10370                 ret.data[i] = Witness_clone(&orig->data[i]);
10371         }
10372         return ret;
10373 }
10374 static jclass LDKCOption_i64Z_Some_class = NULL;
10375 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
10376 static jclass LDKCOption_i64Z_None_class = NULL;
10377 static jmethodID LDKCOption_i64Z_None_meth = NULL;
10378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
10379         LDKCOption_i64Z_Some_class =
10380                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
10381         CHECK(LDKCOption_i64Z_Some_class != NULL);
10382         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
10383         CHECK(LDKCOption_i64Z_Some_meth != NULL);
10384         LDKCOption_i64Z_None_class =
10385                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
10386         CHECK(LDKCOption_i64Z_None_class != NULL);
10387         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
10388         CHECK(LDKCOption_i64Z_None_meth != NULL);
10389 }
10390 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10391         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
10392         switch(obj->tag) {
10393                 case LDKCOption_i64Z_Some: {
10394                         int64_t some_conv = obj->some;
10395                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
10396                 }
10397                 case LDKCOption_i64Z_None: {
10398                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
10399                 }
10400                 default: abort();
10401         }
10402 }
10403 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10404 CHECK(owner->result_ok);
10405         return SocketAddress_clone(&*owner->contents.result);
10406 }
10407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10408         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10409         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10410         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
10411         int64_t ret_ref = tag_ptr(ret_copy, true);
10412         return ret_ref;
10413 }
10414
10415 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10416 CHECK(!owner->result_ok);
10417         return DecodeError_clone(&*owner->contents.err);
10418 }
10419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10420         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10422         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
10423         int64_t ret_ref = tag_ptr(ret_copy, true);
10424         return ret_ref;
10425 }
10426
10427 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10428 CHECK(owner->result_ok);
10429         return SocketAddress_clone(&*owner->contents.result);
10430 }
10431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10432         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10433         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10434         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
10435         int64_t ret_ref = tag_ptr(ret_copy, true);
10436         return ret_ref;
10437 }
10438
10439 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10440 CHECK(!owner->result_ok);
10441         return SocketAddressParseError_clone(&*owner->contents.err);
10442 }
10443 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10444         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10445         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
10446         return ret_conv;
10447 }
10448
10449 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
10450         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
10451         for (size_t i = 0; i < ret.datalen; i++) {
10452                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
10453         }
10454         return ret;
10455 }
10456 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
10457         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
10458         for (size_t i = 0; i < ret.datalen; i++) {
10459                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
10460         }
10461         return ret;
10462 }
10463 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
10464         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
10465         for (size_t i = 0; i < ret.datalen; i++) {
10466                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
10467         }
10468         return ret;
10469 }
10470 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
10471         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
10472         for (size_t i = 0; i < ret.datalen; i++) {
10473                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
10474         }
10475         return ret;
10476 }
10477 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10478         LDKAcceptChannel ret = *owner->contents.result;
10479         ret.is_owned = false;
10480         return ret;
10481 }
10482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10483         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10484         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
10485         int64_t ret_ref = 0;
10486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10488         return ret_ref;
10489 }
10490
10491 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10492 CHECK(!owner->result_ok);
10493         return DecodeError_clone(&*owner->contents.err);
10494 }
10495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10496         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10498         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10499         int64_t ret_ref = tag_ptr(ret_copy, true);
10500         return ret_ref;
10501 }
10502
10503 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10504         LDKAcceptChannelV2 ret = *owner->contents.result;
10505         ret.is_owned = false;
10506         return ret;
10507 }
10508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10509         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10510         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
10511         int64_t ret_ref = 0;
10512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10514         return ret_ref;
10515 }
10516
10517 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10518 CHECK(!owner->result_ok);
10519         return DecodeError_clone(&*owner->contents.err);
10520 }
10521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10522         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10523         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10524         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
10525         int64_t ret_ref = tag_ptr(ret_copy, true);
10526         return ret_ref;
10527 }
10528
10529 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10530         LDKTxAddInput ret = *owner->contents.result;
10531         ret.is_owned = false;
10532         return ret;
10533 }
10534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10535         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10536         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
10537         int64_t ret_ref = 0;
10538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10540         return ret_ref;
10541 }
10542
10543 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10544 CHECK(!owner->result_ok);
10545         return DecodeError_clone(&*owner->contents.err);
10546 }
10547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10548         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10550         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
10551         int64_t ret_ref = tag_ptr(ret_copy, true);
10552         return ret_ref;
10553 }
10554
10555 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10556         LDKTxAddOutput ret = *owner->contents.result;
10557         ret.is_owned = false;
10558         return ret;
10559 }
10560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10561         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10562         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
10563         int64_t ret_ref = 0;
10564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10566         return ret_ref;
10567 }
10568
10569 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10570 CHECK(!owner->result_ok);
10571         return DecodeError_clone(&*owner->contents.err);
10572 }
10573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10574         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10576         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
10577         int64_t ret_ref = tag_ptr(ret_copy, true);
10578         return ret_ref;
10579 }
10580
10581 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10582         LDKTxRemoveInput ret = *owner->contents.result;
10583         ret.is_owned = false;
10584         return ret;
10585 }
10586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10587         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10588         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
10589         int64_t ret_ref = 0;
10590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10592         return ret_ref;
10593 }
10594
10595 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10596 CHECK(!owner->result_ok);
10597         return DecodeError_clone(&*owner->contents.err);
10598 }
10599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10600         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10601         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10602         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
10603         int64_t ret_ref = tag_ptr(ret_copy, true);
10604         return ret_ref;
10605 }
10606
10607 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10608         LDKTxRemoveOutput ret = *owner->contents.result;
10609         ret.is_owned = false;
10610         return ret;
10611 }
10612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10613         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10614         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
10615         int64_t ret_ref = 0;
10616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10618         return ret_ref;
10619 }
10620
10621 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10622 CHECK(!owner->result_ok);
10623         return DecodeError_clone(&*owner->contents.err);
10624 }
10625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10626         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10627         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10628         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
10629         int64_t ret_ref = tag_ptr(ret_copy, true);
10630         return ret_ref;
10631 }
10632
10633 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10634         LDKTxComplete ret = *owner->contents.result;
10635         ret.is_owned = false;
10636         return ret;
10637 }
10638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10639         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10640         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
10641         int64_t ret_ref = 0;
10642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10644         return ret_ref;
10645 }
10646
10647 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10648 CHECK(!owner->result_ok);
10649         return DecodeError_clone(&*owner->contents.err);
10650 }
10651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10652         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10653         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10654         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
10655         int64_t ret_ref = tag_ptr(ret_copy, true);
10656         return ret_ref;
10657 }
10658
10659 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10660         LDKTxSignatures ret = *owner->contents.result;
10661         ret.is_owned = false;
10662         return ret;
10663 }
10664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10665         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10666         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
10667         int64_t ret_ref = 0;
10668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10670         return ret_ref;
10671 }
10672
10673 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10674 CHECK(!owner->result_ok);
10675         return DecodeError_clone(&*owner->contents.err);
10676 }
10677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10678         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10679         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10680         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
10681         int64_t ret_ref = tag_ptr(ret_copy, true);
10682         return ret_ref;
10683 }
10684
10685 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10686         LDKTxInitRbf ret = *owner->contents.result;
10687         ret.is_owned = false;
10688         return ret;
10689 }
10690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10691         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10692         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
10693         int64_t ret_ref = 0;
10694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10696         return ret_ref;
10697 }
10698
10699 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10700 CHECK(!owner->result_ok);
10701         return DecodeError_clone(&*owner->contents.err);
10702 }
10703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10704         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10705         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10706         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
10707         int64_t ret_ref = tag_ptr(ret_copy, true);
10708         return ret_ref;
10709 }
10710
10711 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10712         LDKTxAckRbf ret = *owner->contents.result;
10713         ret.is_owned = false;
10714         return ret;
10715 }
10716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10717         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10718         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
10719         int64_t ret_ref = 0;
10720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10722         return ret_ref;
10723 }
10724
10725 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10726 CHECK(!owner->result_ok);
10727         return DecodeError_clone(&*owner->contents.err);
10728 }
10729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10730         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10731         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10732         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
10733         int64_t ret_ref = tag_ptr(ret_copy, true);
10734         return ret_ref;
10735 }
10736
10737 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10738         LDKTxAbort ret = *owner->contents.result;
10739         ret.is_owned = false;
10740         return ret;
10741 }
10742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10743         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10744         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
10745         int64_t ret_ref = 0;
10746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10748         return ret_ref;
10749 }
10750
10751 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10752 CHECK(!owner->result_ok);
10753         return DecodeError_clone(&*owner->contents.err);
10754 }
10755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10756         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10758         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
10759         int64_t ret_ref = tag_ptr(ret_copy, true);
10760         return ret_ref;
10761 }
10762
10763 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10764         LDKAnnouncementSignatures ret = *owner->contents.result;
10765         ret.is_owned = false;
10766         return ret;
10767 }
10768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10769         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10770         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10771         int64_t ret_ref = 0;
10772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10774         return ret_ref;
10775 }
10776
10777 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10778 CHECK(!owner->result_ok);
10779         return DecodeError_clone(&*owner->contents.err);
10780 }
10781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10782         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10783         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10784         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10785         int64_t ret_ref = tag_ptr(ret_copy, true);
10786         return ret_ref;
10787 }
10788
10789 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10790         LDKChannelReestablish ret = *owner->contents.result;
10791         ret.is_owned = false;
10792         return ret;
10793 }
10794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10795         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10796         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10797         int64_t ret_ref = 0;
10798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10800         return ret_ref;
10801 }
10802
10803 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10804 CHECK(!owner->result_ok);
10805         return DecodeError_clone(&*owner->contents.err);
10806 }
10807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10808         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10809         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10810         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
10811         int64_t ret_ref = tag_ptr(ret_copy, true);
10812         return ret_ref;
10813 }
10814
10815 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10816         LDKClosingSigned ret = *owner->contents.result;
10817         ret.is_owned = false;
10818         return ret;
10819 }
10820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10821         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10822         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
10823         int64_t ret_ref = 0;
10824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10826         return ret_ref;
10827 }
10828
10829 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10830 CHECK(!owner->result_ok);
10831         return DecodeError_clone(&*owner->contents.err);
10832 }
10833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10834         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10836         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
10837         int64_t ret_ref = tag_ptr(ret_copy, true);
10838         return ret_ref;
10839 }
10840
10841 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10842         LDKClosingSignedFeeRange ret = *owner->contents.result;
10843         ret.is_owned = false;
10844         return ret;
10845 }
10846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10847         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10848         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
10849         int64_t ret_ref = 0;
10850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10852         return ret_ref;
10853 }
10854
10855 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10856 CHECK(!owner->result_ok);
10857         return DecodeError_clone(&*owner->contents.err);
10858 }
10859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10860         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10861         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10862         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
10863         int64_t ret_ref = tag_ptr(ret_copy, true);
10864         return ret_ref;
10865 }
10866
10867 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10868         LDKCommitmentSigned ret = *owner->contents.result;
10869         ret.is_owned = false;
10870         return ret;
10871 }
10872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10873         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10874         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
10875         int64_t ret_ref = 0;
10876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10878         return ret_ref;
10879 }
10880
10881 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10882 CHECK(!owner->result_ok);
10883         return DecodeError_clone(&*owner->contents.err);
10884 }
10885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10886         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10888         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
10889         int64_t ret_ref = tag_ptr(ret_copy, true);
10890         return ret_ref;
10891 }
10892
10893 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10894         LDKFundingCreated ret = *owner->contents.result;
10895         ret.is_owned = false;
10896         return ret;
10897 }
10898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10899         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10900         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
10901         int64_t ret_ref = 0;
10902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10904         return ret_ref;
10905 }
10906
10907 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10908 CHECK(!owner->result_ok);
10909         return DecodeError_clone(&*owner->contents.err);
10910 }
10911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10912         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10914         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
10915         int64_t ret_ref = tag_ptr(ret_copy, true);
10916         return ret_ref;
10917 }
10918
10919 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10920         LDKFundingSigned ret = *owner->contents.result;
10921         ret.is_owned = false;
10922         return ret;
10923 }
10924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10925         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10926         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
10927         int64_t ret_ref = 0;
10928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10930         return ret_ref;
10931 }
10932
10933 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10934 CHECK(!owner->result_ok);
10935         return DecodeError_clone(&*owner->contents.err);
10936 }
10937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10938         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10939         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10940         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
10941         int64_t ret_ref = tag_ptr(ret_copy, true);
10942         return ret_ref;
10943 }
10944
10945 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10946         LDKChannelReady ret = *owner->contents.result;
10947         ret.is_owned = false;
10948         return ret;
10949 }
10950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10951         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10952         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
10953         int64_t ret_ref = 0;
10954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10956         return ret_ref;
10957 }
10958
10959 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10960 CHECK(!owner->result_ok);
10961         return DecodeError_clone(&*owner->contents.err);
10962 }
10963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10964         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10965         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10966         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
10967         int64_t ret_ref = tag_ptr(ret_copy, true);
10968         return ret_ref;
10969 }
10970
10971 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10972         LDKInit ret = *owner->contents.result;
10973         ret.is_owned = false;
10974         return ret;
10975 }
10976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10977         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10978         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
10979         int64_t ret_ref = 0;
10980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10982         return ret_ref;
10983 }
10984
10985 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10986 CHECK(!owner->result_ok);
10987         return DecodeError_clone(&*owner->contents.err);
10988 }
10989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10990         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10991         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10992         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10993         int64_t ret_ref = tag_ptr(ret_copy, true);
10994         return ret_ref;
10995 }
10996
10997 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10998         LDKOpenChannel ret = *owner->contents.result;
10999         ret.is_owned = false;
11000         return ret;
11001 }
11002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11003         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11004         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
11005         int64_t ret_ref = 0;
11006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11008         return ret_ref;
11009 }
11010
11011 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11012 CHECK(!owner->result_ok);
11013         return DecodeError_clone(&*owner->contents.err);
11014 }
11015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11016         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11017         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11018         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
11019         int64_t ret_ref = tag_ptr(ret_copy, true);
11020         return ret_ref;
11021 }
11022
11023 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11024         LDKOpenChannelV2 ret = *owner->contents.result;
11025         ret.is_owned = false;
11026         return ret;
11027 }
11028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11029         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11030         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
11031         int64_t ret_ref = 0;
11032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11034         return ret_ref;
11035 }
11036
11037 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11038 CHECK(!owner->result_ok);
11039         return DecodeError_clone(&*owner->contents.err);
11040 }
11041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11042         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11043         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11044         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
11045         int64_t ret_ref = tag_ptr(ret_copy, true);
11046         return ret_ref;
11047 }
11048
11049 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11050         LDKRevokeAndACK ret = *owner->contents.result;
11051         ret.is_owned = false;
11052         return ret;
11053 }
11054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11055         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11056         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
11057         int64_t ret_ref = 0;
11058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11060         return ret_ref;
11061 }
11062
11063 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11064 CHECK(!owner->result_ok);
11065         return DecodeError_clone(&*owner->contents.err);
11066 }
11067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11068         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11069         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11070         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
11071         int64_t ret_ref = tag_ptr(ret_copy, true);
11072         return ret_ref;
11073 }
11074
11075 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11076         LDKShutdown ret = *owner->contents.result;
11077         ret.is_owned = false;
11078         return ret;
11079 }
11080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11081         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11082         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
11083         int64_t ret_ref = 0;
11084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11086         return ret_ref;
11087 }
11088
11089 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11090 CHECK(!owner->result_ok);
11091         return DecodeError_clone(&*owner->contents.err);
11092 }
11093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11094         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11095         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11096         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
11097         int64_t ret_ref = tag_ptr(ret_copy, true);
11098         return ret_ref;
11099 }
11100
11101 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11102         LDKUpdateFailHTLC ret = *owner->contents.result;
11103         ret.is_owned = false;
11104         return ret;
11105 }
11106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11107         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11108         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
11109         int64_t ret_ref = 0;
11110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11112         return ret_ref;
11113 }
11114
11115 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11116 CHECK(!owner->result_ok);
11117         return DecodeError_clone(&*owner->contents.err);
11118 }
11119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11120         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11121         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11122         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
11123         int64_t ret_ref = tag_ptr(ret_copy, true);
11124         return ret_ref;
11125 }
11126
11127 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11128         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
11129         ret.is_owned = false;
11130         return ret;
11131 }
11132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11133         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11134         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
11135         int64_t ret_ref = 0;
11136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11138         return ret_ref;
11139 }
11140
11141 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11142 CHECK(!owner->result_ok);
11143         return DecodeError_clone(&*owner->contents.err);
11144 }
11145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11146         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11147         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11148         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
11149         int64_t ret_ref = tag_ptr(ret_copy, true);
11150         return ret_ref;
11151 }
11152
11153 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11154         LDKUpdateFee ret = *owner->contents.result;
11155         ret.is_owned = false;
11156         return ret;
11157 }
11158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11159         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11160         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
11161         int64_t ret_ref = 0;
11162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11164         return ret_ref;
11165 }
11166
11167 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11168 CHECK(!owner->result_ok);
11169         return DecodeError_clone(&*owner->contents.err);
11170 }
11171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11172         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11173         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11174         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
11175         int64_t ret_ref = tag_ptr(ret_copy, true);
11176         return ret_ref;
11177 }
11178
11179 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11180         LDKUpdateFulfillHTLC ret = *owner->contents.result;
11181         ret.is_owned = false;
11182         return ret;
11183 }
11184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11185         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11186         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
11187         int64_t ret_ref = 0;
11188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11190         return ret_ref;
11191 }
11192
11193 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11194 CHECK(!owner->result_ok);
11195         return DecodeError_clone(&*owner->contents.err);
11196 }
11197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11198         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11199         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11200         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
11201         int64_t ret_ref = tag_ptr(ret_copy, true);
11202         return ret_ref;
11203 }
11204
11205 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11206         LDKUpdateAddHTLC ret = *owner->contents.result;
11207         ret.is_owned = false;
11208         return ret;
11209 }
11210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11211         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11212         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
11213         int64_t ret_ref = 0;
11214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11216         return ret_ref;
11217 }
11218
11219 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11220 CHECK(!owner->result_ok);
11221         return DecodeError_clone(&*owner->contents.err);
11222 }
11223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11224         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11225         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11226         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
11227         int64_t ret_ref = tag_ptr(ret_copy, true);
11228         return ret_ref;
11229 }
11230
11231 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11232         LDKOnionMessage ret = *owner->contents.result;
11233         ret.is_owned = false;
11234         return ret;
11235 }
11236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11237         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11238         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
11239         int64_t ret_ref = 0;
11240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11242         return ret_ref;
11243 }
11244
11245 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11246 CHECK(!owner->result_ok);
11247         return DecodeError_clone(&*owner->contents.err);
11248 }
11249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11250         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11251         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11252         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
11253         int64_t ret_ref = tag_ptr(ret_copy, true);
11254         return ret_ref;
11255 }
11256
11257 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11258         LDKPing ret = *owner->contents.result;
11259         ret.is_owned = false;
11260         return ret;
11261 }
11262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11263         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11264         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
11265         int64_t ret_ref = 0;
11266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11268         return ret_ref;
11269 }
11270
11271 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11272 CHECK(!owner->result_ok);
11273         return DecodeError_clone(&*owner->contents.err);
11274 }
11275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11276         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11277         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11278         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
11279         int64_t ret_ref = tag_ptr(ret_copy, true);
11280         return ret_ref;
11281 }
11282
11283 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11284         LDKPong ret = *owner->contents.result;
11285         ret.is_owned = false;
11286         return ret;
11287 }
11288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11289         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11290         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
11291         int64_t ret_ref = 0;
11292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11294         return ret_ref;
11295 }
11296
11297 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11298 CHECK(!owner->result_ok);
11299         return DecodeError_clone(&*owner->contents.err);
11300 }
11301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11302         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11303         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11304         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
11305         int64_t ret_ref = tag_ptr(ret_copy, true);
11306         return ret_ref;
11307 }
11308
11309 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11310         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
11311         ret.is_owned = false;
11312         return ret;
11313 }
11314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11315         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11316         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11317         int64_t ret_ref = 0;
11318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11320         return ret_ref;
11321 }
11322
11323 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11324 CHECK(!owner->result_ok);
11325         return DecodeError_clone(&*owner->contents.err);
11326 }
11327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11328         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11329         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11330         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11331         int64_t ret_ref = tag_ptr(ret_copy, true);
11332         return ret_ref;
11333 }
11334
11335 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11336         LDKChannelAnnouncement ret = *owner->contents.result;
11337         ret.is_owned = false;
11338         return ret;
11339 }
11340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11341         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11342         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11343         int64_t ret_ref = 0;
11344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11346         return ret_ref;
11347 }
11348
11349 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11350 CHECK(!owner->result_ok);
11351         return DecodeError_clone(&*owner->contents.err);
11352 }
11353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11354         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11355         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11356         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11357         int64_t ret_ref = tag_ptr(ret_copy, true);
11358         return ret_ref;
11359 }
11360
11361 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11362         LDKUnsignedChannelUpdate ret = *owner->contents.result;
11363         ret.is_owned = false;
11364         return ret;
11365 }
11366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11367         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11368         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11369         int64_t ret_ref = 0;
11370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11372         return ret_ref;
11373 }
11374
11375 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11376 CHECK(!owner->result_ok);
11377         return DecodeError_clone(&*owner->contents.err);
11378 }
11379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11380         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11381         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11382         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
11383         int64_t ret_ref = tag_ptr(ret_copy, true);
11384         return ret_ref;
11385 }
11386
11387 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11388         LDKChannelUpdate ret = *owner->contents.result;
11389         ret.is_owned = false;
11390         return ret;
11391 }
11392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11393         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11394         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11395         int64_t ret_ref = 0;
11396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11398         return ret_ref;
11399 }
11400
11401 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11402 CHECK(!owner->result_ok);
11403         return DecodeError_clone(&*owner->contents.err);
11404 }
11405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11406         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11407         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11408         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
11409         int64_t ret_ref = tag_ptr(ret_copy, true);
11410         return ret_ref;
11411 }
11412
11413 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11414         LDKErrorMessage ret = *owner->contents.result;
11415         ret.is_owned = false;
11416         return ret;
11417 }
11418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11419         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11420         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
11421         int64_t ret_ref = 0;
11422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11424         return ret_ref;
11425 }
11426
11427 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11428 CHECK(!owner->result_ok);
11429         return DecodeError_clone(&*owner->contents.err);
11430 }
11431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11432         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11433         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11434         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
11435         int64_t ret_ref = tag_ptr(ret_copy, true);
11436         return ret_ref;
11437 }
11438
11439 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11440         LDKWarningMessage ret = *owner->contents.result;
11441         ret.is_owned = false;
11442         return ret;
11443 }
11444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11445         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11446         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
11447         int64_t ret_ref = 0;
11448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11450         return ret_ref;
11451 }
11452
11453 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11454 CHECK(!owner->result_ok);
11455         return DecodeError_clone(&*owner->contents.err);
11456 }
11457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11458         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11459         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11460         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
11461         int64_t ret_ref = tag_ptr(ret_copy, true);
11462         return ret_ref;
11463 }
11464
11465 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11466         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
11467         ret.is_owned = false;
11468         return ret;
11469 }
11470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11471         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11472         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11473         int64_t ret_ref = 0;
11474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11476         return ret_ref;
11477 }
11478
11479 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11480 CHECK(!owner->result_ok);
11481         return DecodeError_clone(&*owner->contents.err);
11482 }
11483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11484         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11485         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11486         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11487         int64_t ret_ref = tag_ptr(ret_copy, true);
11488         return ret_ref;
11489 }
11490
11491 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11492         LDKNodeAnnouncement ret = *owner->contents.result;
11493         ret.is_owned = false;
11494         return ret;
11495 }
11496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11497         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11498         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11499         int64_t ret_ref = 0;
11500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11502         return ret_ref;
11503 }
11504
11505 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11506 CHECK(!owner->result_ok);
11507         return DecodeError_clone(&*owner->contents.err);
11508 }
11509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11510         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11511         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11512         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11513         int64_t ret_ref = tag_ptr(ret_copy, true);
11514         return ret_ref;
11515 }
11516
11517 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11518         LDKQueryShortChannelIds ret = *owner->contents.result;
11519         ret.is_owned = false;
11520         return ret;
11521 }
11522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11523         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11524         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11525         int64_t ret_ref = 0;
11526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11528         return ret_ref;
11529 }
11530
11531 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11532 CHECK(!owner->result_ok);
11533         return DecodeError_clone(&*owner->contents.err);
11534 }
11535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11536         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11537         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11538         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11539         int64_t ret_ref = tag_ptr(ret_copy, true);
11540         return ret_ref;
11541 }
11542
11543 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11544         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11545         ret.is_owned = false;
11546         return ret;
11547 }
11548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11549         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11550         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11551         int64_t ret_ref = 0;
11552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11554         return ret_ref;
11555 }
11556
11557 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11558 CHECK(!owner->result_ok);
11559         return DecodeError_clone(&*owner->contents.err);
11560 }
11561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11562         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11563         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11564         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11565         int64_t ret_ref = tag_ptr(ret_copy, true);
11566         return ret_ref;
11567 }
11568
11569 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11570         LDKQueryChannelRange ret = *owner->contents.result;
11571         ret.is_owned = false;
11572         return ret;
11573 }
11574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11575         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11576         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11577         int64_t ret_ref = 0;
11578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11580         return ret_ref;
11581 }
11582
11583 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11584 CHECK(!owner->result_ok);
11585         return DecodeError_clone(&*owner->contents.err);
11586 }
11587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11588         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11590         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11591         int64_t ret_ref = tag_ptr(ret_copy, true);
11592         return ret_ref;
11593 }
11594
11595 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11596         LDKReplyChannelRange ret = *owner->contents.result;
11597         ret.is_owned = false;
11598         return ret;
11599 }
11600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11601         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11602         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11603         int64_t ret_ref = 0;
11604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11606         return ret_ref;
11607 }
11608
11609 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11610 CHECK(!owner->result_ok);
11611         return DecodeError_clone(&*owner->contents.err);
11612 }
11613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11614         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11615         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11616         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11617         int64_t ret_ref = tag_ptr(ret_copy, true);
11618         return ret_ref;
11619 }
11620
11621 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11622         LDKGossipTimestampFilter ret = *owner->contents.result;
11623         ret.is_owned = false;
11624         return ret;
11625 }
11626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11627         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11628         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11629         int64_t ret_ref = 0;
11630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11632         return ret_ref;
11633 }
11634
11635 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11636 CHECK(!owner->result_ok);
11637         return DecodeError_clone(&*owner->contents.err);
11638 }
11639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11640         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11642         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11643         int64_t ret_ref = tag_ptr(ret_copy, true);
11644         return ret_ref;
11645 }
11646
11647 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11648         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11649         for (size_t i = 0; i < ret.datalen; i++) {
11650                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11651         }
11652         return ret;
11653 }
11654 static jclass LDKSignOrCreationError_SignError_class = NULL;
11655 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11656 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11657 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11659         LDKSignOrCreationError_SignError_class =
11660                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11661         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11662         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11663         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11664         LDKSignOrCreationError_CreationError_class =
11665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11666         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11667         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11668         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11669 }
11670 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11671         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11672         switch(obj->tag) {
11673                 case LDKSignOrCreationError_SignError: {
11674                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11675                 }
11676                 case LDKSignOrCreationError_CreationError: {
11677                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11678                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11679                 }
11680                 default: abort();
11681         }
11682 }
11683 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11684         LDKBolt11Invoice ret = *owner->contents.result;
11685         ret.is_owned = false;
11686         return ret;
11687 }
11688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11689         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11690         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11691         int64_t ret_ref = 0;
11692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11694         return ret_ref;
11695 }
11696
11697 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11698 CHECK(!owner->result_ok);
11699         return SignOrCreationError_clone(&*owner->contents.err);
11700 }
11701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11702         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11703         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11704         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11705         int64_t ret_ref = tag_ptr(ret_copy, true);
11706         return ret_ref;
11707 }
11708
11709 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
11710         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
11711         for (size_t i = 0; i < ret.datalen; i++) {
11712                 ret.data[i] = Future_clone(&orig->data[i]);
11713         }
11714         return ret;
11715 }
11716 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11717 CHECK(owner->result_ok);
11718         return OffersMessage_clone(&*owner->contents.result);
11719 }
11720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11721         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11722         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11723         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11724         int64_t ret_ref = tag_ptr(ret_copy, true);
11725         return ret_ref;
11726 }
11727
11728 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11729 CHECK(!owner->result_ok);
11730         return DecodeError_clone(&*owner->contents.err);
11731 }
11732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11733         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11734         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11735         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11736         int64_t ret_ref = tag_ptr(ret_copy, true);
11737         return ret_ref;
11738 }
11739
11740 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
11741 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
11742 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
11743 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
11744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
11745         LDKCOption_HTLCClaimZ_Some_class =
11746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
11747         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
11748         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
11749         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
11750         LDKCOption_HTLCClaimZ_None_class =
11751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
11752         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
11753         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
11754         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
11755 }
11756 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11757         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11758         switch(obj->tag) {
11759                 case LDKCOption_HTLCClaimZ_Some: {
11760                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
11761                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
11762                 }
11763                 case LDKCOption_HTLCClaimZ_None: {
11764                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
11765                 }
11766                 default: abort();
11767         }
11768 }
11769 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11770         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11771         ret.is_owned = false;
11772         return ret;
11773 }
11774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11775         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11776         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11777         int64_t ret_ref = 0;
11778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11780         return ret_ref;
11781 }
11782
11783 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11784 CHECK(!owner->result_ok);
11785         return DecodeError_clone(&*owner->contents.err);
11786 }
11787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11788         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11790         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11791         int64_t ret_ref = tag_ptr(ret_copy, true);
11792         return ret_ref;
11793 }
11794
11795 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11796         LDKTxCreationKeys ret = *owner->contents.result;
11797         ret.is_owned = false;
11798         return ret;
11799 }
11800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11801         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11802         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11803         int64_t ret_ref = 0;
11804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11806         return ret_ref;
11807 }
11808
11809 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11810 CHECK(!owner->result_ok);
11811         return DecodeError_clone(&*owner->contents.err);
11812 }
11813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11814         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11816         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
11817         int64_t ret_ref = tag_ptr(ret_copy, true);
11818         return ret_ref;
11819 }
11820
11821 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11822         LDKChannelPublicKeys ret = *owner->contents.result;
11823         ret.is_owned = false;
11824         return ret;
11825 }
11826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11827         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11828         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
11829         int64_t ret_ref = 0;
11830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11832         return ret_ref;
11833 }
11834
11835 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11836 CHECK(!owner->result_ok);
11837         return DecodeError_clone(&*owner->contents.err);
11838 }
11839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11840         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11841         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11842         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
11843         int64_t ret_ref = tag_ptr(ret_copy, true);
11844         return ret_ref;
11845 }
11846
11847 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11848         LDKHTLCOutputInCommitment ret = *owner->contents.result;
11849         ret.is_owned = false;
11850         return ret;
11851 }
11852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11853         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11854         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
11855         int64_t ret_ref = 0;
11856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11858         return ret_ref;
11859 }
11860
11861 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11862 CHECK(!owner->result_ok);
11863         return DecodeError_clone(&*owner->contents.err);
11864 }
11865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11866         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11867         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11868         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
11869         int64_t ret_ref = tag_ptr(ret_copy, true);
11870         return ret_ref;
11871 }
11872
11873 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11874         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
11875         ret.is_owned = false;
11876         return ret;
11877 }
11878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11879         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11880         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11881         int64_t ret_ref = 0;
11882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11884         return ret_ref;
11885 }
11886
11887 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11888 CHECK(!owner->result_ok);
11889         return DecodeError_clone(&*owner->contents.err);
11890 }
11891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11892         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11893         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11894         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11895         int64_t ret_ref = tag_ptr(ret_copy, true);
11896         return ret_ref;
11897 }
11898
11899 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11900         LDKChannelTransactionParameters ret = *owner->contents.result;
11901         ret.is_owned = false;
11902         return ret;
11903 }
11904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11905         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11906         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11907         int64_t ret_ref = 0;
11908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11910         return ret_ref;
11911 }
11912
11913 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11914 CHECK(!owner->result_ok);
11915         return DecodeError_clone(&*owner->contents.err);
11916 }
11917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11918         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11920         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11921         int64_t ret_ref = tag_ptr(ret_copy, true);
11922         return ret_ref;
11923 }
11924
11925 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11926         LDKHolderCommitmentTransaction ret = *owner->contents.result;
11927         ret.is_owned = false;
11928         return ret;
11929 }
11930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11931         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11932         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11933         int64_t ret_ref = 0;
11934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11936         return ret_ref;
11937 }
11938
11939 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11940 CHECK(!owner->result_ok);
11941         return DecodeError_clone(&*owner->contents.err);
11942 }
11943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11944         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11946         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11947         int64_t ret_ref = tag_ptr(ret_copy, true);
11948         return ret_ref;
11949 }
11950
11951 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11952         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
11953         ret.is_owned = false;
11954         return ret;
11955 }
11956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11957         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11958         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11959         int64_t ret_ref = 0;
11960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11962         return ret_ref;
11963 }
11964
11965 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11966 CHECK(!owner->result_ok);
11967         return DecodeError_clone(&*owner->contents.err);
11968 }
11969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11970         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11972         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11973         int64_t ret_ref = tag_ptr(ret_copy, true);
11974         return ret_ref;
11975 }
11976
11977 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11978         LDKTrustedClosingTransaction ret = *owner->contents.result;
11979         ret.is_owned = false;
11980         return ret;
11981 }
11982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11983         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11984         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
11985         int64_t ret_ref = 0;
11986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11988         return ret_ref;
11989 }
11990
11991 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11992 CHECK(!owner->result_ok);
11993         return *owner->contents.err;
11994 }
11995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11996         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11997         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
11998 }
11999
12000 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12001         LDKCommitmentTransaction ret = *owner->contents.result;
12002         ret.is_owned = false;
12003         return ret;
12004 }
12005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12006         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12007         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12008         int64_t ret_ref = 0;
12009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12011         return ret_ref;
12012 }
12013
12014 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12015 CHECK(!owner->result_ok);
12016         return DecodeError_clone(&*owner->contents.err);
12017 }
12018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12019         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12020         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12021         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12022         int64_t ret_ref = tag_ptr(ret_copy, true);
12023         return ret_ref;
12024 }
12025
12026 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12027         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
12028         ret.is_owned = false;
12029         return ret;
12030 }
12031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12032         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12033         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
12034         int64_t ret_ref = 0;
12035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12037         return ret_ref;
12038 }
12039
12040 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12041 CHECK(!owner->result_ok);
12042         return *owner->contents.err;
12043 }
12044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12045         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12046         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
12047 }
12048
12049 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12050 CHECK(owner->result_ok);
12051         return *owner->contents.result;
12052 }
12053 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12054         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12055         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
12056         jobjectArray ret_arr = NULL;
12057         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
12058         ;
12059         for (size_t i = 0; i < ret_var.datalen; i++) {
12060                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
12061                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
12062                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
12063         }
12064         
12065         return ret_arr;
12066 }
12067
12068 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12069 CHECK(!owner->result_ok);
12070         return *owner->contents.err;
12071 }
12072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12073         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12074         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
12075 }
12076
12077 static jclass LDKCOption_usizeZ_Some_class = NULL;
12078 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
12079 static jclass LDKCOption_usizeZ_None_class = NULL;
12080 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
12081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
12082         LDKCOption_usizeZ_Some_class =
12083                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
12084         CHECK(LDKCOption_usizeZ_Some_class != NULL);
12085         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
12086         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
12087         LDKCOption_usizeZ_None_class =
12088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
12089         CHECK(LDKCOption_usizeZ_None_class != NULL);
12090         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
12091         CHECK(LDKCOption_usizeZ_None_meth != NULL);
12092 }
12093 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12094         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
12095         switch(obj->tag) {
12096                 case LDKCOption_usizeZ_Some: {
12097                         int64_t some_conv = obj->some;
12098                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
12099                 }
12100                 case LDKCOption_usizeZ_None: {
12101                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
12102                 }
12103                 default: abort();
12104         }
12105 }
12106 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12107         LDKShutdownScript ret = *owner->contents.result;
12108         ret.is_owned = false;
12109         return ret;
12110 }
12111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12112         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12113         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
12114         int64_t ret_ref = 0;
12115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12117         return ret_ref;
12118 }
12119
12120 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12121 CHECK(!owner->result_ok);
12122         return DecodeError_clone(&*owner->contents.err);
12123 }
12124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12125         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12126         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12127         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
12128         int64_t ret_ref = tag_ptr(ret_copy, true);
12129         return ret_ref;
12130 }
12131
12132 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12133         LDKShutdownScript ret = *owner->contents.result;
12134         ret.is_owned = false;
12135         return ret;
12136 }
12137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12138         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12139         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
12140         int64_t ret_ref = 0;
12141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12143         return ret_ref;
12144 }
12145
12146 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12147         LDKInvalidShutdownScript ret = *owner->contents.err;
12148         ret.is_owned = false;
12149         return ret;
12150 }
12151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12152         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12153         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
12154         int64_t ret_ref = 0;
12155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12157         return ret_ref;
12158 }
12159
12160 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
12161 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
12162 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
12163 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
12164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
12165         LDKPaymentPurpose_InvoicePayment_class =
12166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
12167         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
12168         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
12169         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
12170         LDKPaymentPurpose_SpontaneousPayment_class =
12171                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
12172         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
12173         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
12174         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
12175 }
12176 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12177         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
12178         switch(obj->tag) {
12179                 case LDKPaymentPurpose_InvoicePayment: {
12180                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
12181                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
12182                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
12183                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
12184                 }
12185                 case LDKPaymentPurpose_SpontaneousPayment: {
12186                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
12187                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
12188                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
12189                 }
12190                 default: abort();
12191         }
12192 }
12193 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12194 CHECK(owner->result_ok);
12195         return PaymentPurpose_clone(&*owner->contents.result);
12196 }
12197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12198         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12199         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12200         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
12201         int64_t ret_ref = tag_ptr(ret_copy, true);
12202         return ret_ref;
12203 }
12204
12205 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12206 CHECK(!owner->result_ok);
12207         return DecodeError_clone(&*owner->contents.err);
12208 }
12209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12210         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12212         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
12213         int64_t ret_ref = tag_ptr(ret_copy, true);
12214         return ret_ref;
12215 }
12216
12217 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12218         LDKClaimedHTLC ret = *owner->contents.result;
12219         ret.is_owned = false;
12220         return ret;
12221 }
12222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12223         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12224         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
12225         int64_t ret_ref = 0;
12226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12228         return ret_ref;
12229 }
12230
12231 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12232 CHECK(!owner->result_ok);
12233         return DecodeError_clone(&*owner->contents.err);
12234 }
12235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12236         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12238         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
12239         int64_t ret_ref = tag_ptr(ret_copy, true);
12240         return ret_ref;
12241 }
12242
12243 static jclass LDKPathFailure_InitialSend_class = NULL;
12244 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
12245 static jclass LDKPathFailure_OnPath_class = NULL;
12246 static jmethodID LDKPathFailure_OnPath_meth = NULL;
12247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
12248         LDKPathFailure_InitialSend_class =
12249                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
12250         CHECK(LDKPathFailure_InitialSend_class != NULL);
12251         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
12252         CHECK(LDKPathFailure_InitialSend_meth != NULL);
12253         LDKPathFailure_OnPath_class =
12254                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
12255         CHECK(LDKPathFailure_OnPath_class != NULL);
12256         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
12257         CHECK(LDKPathFailure_OnPath_meth != NULL);
12258 }
12259 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12260         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
12261         switch(obj->tag) {
12262                 case LDKPathFailure_InitialSend: {
12263                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
12264                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
12265                 }
12266                 case LDKPathFailure_OnPath: {
12267                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
12268                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
12269                 }
12270                 default: abort();
12271         }
12272 }
12273 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
12274 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
12275 static jclass LDKCOption_PathFailureZ_None_class = NULL;
12276 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
12277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
12278         LDKCOption_PathFailureZ_Some_class =
12279                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
12280         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
12281         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
12282         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
12283         LDKCOption_PathFailureZ_None_class =
12284                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
12285         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
12286         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
12287         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
12288 }
12289 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12290         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
12291         switch(obj->tag) {
12292                 case LDKCOption_PathFailureZ_Some: {
12293                         int64_t some_ref = tag_ptr(&obj->some, false);
12294                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
12295                 }
12296                 case LDKCOption_PathFailureZ_None: {
12297                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
12298                 }
12299                 default: abort();
12300         }
12301 }
12302 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12303 CHECK(owner->result_ok);
12304         return COption_PathFailureZ_clone(&*owner->contents.result);
12305 }
12306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12307         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12308         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
12309         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
12310         int64_t ret_ref = tag_ptr(ret_copy, true);
12311         return ret_ref;
12312 }
12313
12314 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12315 CHECK(!owner->result_ok);
12316         return DecodeError_clone(&*owner->contents.err);
12317 }
12318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12319         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12321         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
12322         int64_t ret_ref = tag_ptr(ret_copy, true);
12323         return ret_ref;
12324 }
12325
12326 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
12327 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
12328 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
12329 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
12330 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
12331 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
12332 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
12333 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
12334 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
12335 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
12336 static jclass LDKClosureReason_ProcessingError_class = NULL;
12337 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
12338 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
12339 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
12340 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
12341 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
12342 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
12343 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
12344 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
12345 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
12346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
12347         LDKClosureReason_CounterpartyForceClosed_class =
12348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
12349         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
12350         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
12351         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
12352         LDKClosureReason_HolderForceClosed_class =
12353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
12354         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
12355         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
12356         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
12357         LDKClosureReason_CooperativeClosure_class =
12358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
12359         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
12360         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
12361         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
12362         LDKClosureReason_CommitmentTxConfirmed_class =
12363                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
12364         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
12365         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
12366         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
12367         LDKClosureReason_FundingTimedOut_class =
12368                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
12369         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
12370         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
12371         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
12372         LDKClosureReason_ProcessingError_class =
12373                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
12374         CHECK(LDKClosureReason_ProcessingError_class != NULL);
12375         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
12376         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
12377         LDKClosureReason_DisconnectedPeer_class =
12378                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
12379         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
12380         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
12381         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
12382         LDKClosureReason_OutdatedChannelManager_class =
12383                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
12384         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
12385         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
12386         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
12387         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
12388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
12389         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
12390         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
12391         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
12392         LDKClosureReason_FundingBatchClosure_class =
12393                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
12394         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
12395         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
12396         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
12397 }
12398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12399         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
12400         switch(obj->tag) {
12401                 case LDKClosureReason_CounterpartyForceClosed: {
12402                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
12403                         int64_t peer_msg_ref = 0;
12404                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
12405                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
12406                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
12407                 }
12408                 case LDKClosureReason_HolderForceClosed: {
12409                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
12410                 }
12411                 case LDKClosureReason_CooperativeClosure: {
12412                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
12413                 }
12414                 case LDKClosureReason_CommitmentTxConfirmed: {
12415                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
12416                 }
12417                 case LDKClosureReason_FundingTimedOut: {
12418                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
12419                 }
12420                 case LDKClosureReason_ProcessingError: {
12421                         LDKStr err_str = obj->processing_error.err;
12422                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
12423                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
12424                 }
12425                 case LDKClosureReason_DisconnectedPeer: {
12426                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
12427                 }
12428                 case LDKClosureReason_OutdatedChannelManager: {
12429                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
12430                 }
12431                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
12432                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
12433                 }
12434                 case LDKClosureReason_FundingBatchClosure: {
12435                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
12436                 }
12437                 default: abort();
12438         }
12439 }
12440 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
12441 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
12442 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
12443 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
12444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
12445         LDKCOption_ClosureReasonZ_Some_class =
12446                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
12447         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
12448         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
12449         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
12450         LDKCOption_ClosureReasonZ_None_class =
12451                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
12452         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
12453         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
12454         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
12455 }
12456 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12457         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
12458         switch(obj->tag) {
12459                 case LDKCOption_ClosureReasonZ_Some: {
12460                         int64_t some_ref = tag_ptr(&obj->some, false);
12461                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
12462                 }
12463                 case LDKCOption_ClosureReasonZ_None: {
12464                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
12465                 }
12466                 default: abort();
12467         }
12468 }
12469 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12470 CHECK(owner->result_ok);
12471         return COption_ClosureReasonZ_clone(&*owner->contents.result);
12472 }
12473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12474         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12475         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12476         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
12477         int64_t ret_ref = tag_ptr(ret_copy, true);
12478         return ret_ref;
12479 }
12480
12481 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12482 CHECK(!owner->result_ok);
12483         return DecodeError_clone(&*owner->contents.err);
12484 }
12485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12486         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12488         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
12489         int64_t ret_ref = tag_ptr(ret_copy, true);
12490         return ret_ref;
12491 }
12492
12493 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
12494 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
12495 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
12496 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
12497 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
12498 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
12499 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
12500 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
12501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
12502         LDKHTLCDestination_NextHopChannel_class =
12503                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
12504         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
12505         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
12506         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
12507         LDKHTLCDestination_UnknownNextHop_class =
12508                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
12509         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
12510         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
12511         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
12512         LDKHTLCDestination_InvalidForward_class =
12513                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
12514         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
12515         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
12516         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
12517         LDKHTLCDestination_FailedPayment_class =
12518                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
12519         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
12520         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
12521         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
12522 }
12523 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12524         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
12525         switch(obj->tag) {
12526                 case LDKHTLCDestination_NextHopChannel: {
12527                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
12528                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
12529                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12530                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
12531                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
12532                 }
12533                 case LDKHTLCDestination_UnknownNextHop: {
12534                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
12535                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
12536                 }
12537                 case LDKHTLCDestination_InvalidForward: {
12538                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
12539                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
12540                 }
12541                 case LDKHTLCDestination_FailedPayment: {
12542                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12543                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
12544                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
12545                 }
12546                 default: abort();
12547         }
12548 }
12549 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
12550 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
12551 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
12552 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
12553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
12554         LDKCOption_HTLCDestinationZ_Some_class =
12555                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
12556         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
12557         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
12558         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
12559         LDKCOption_HTLCDestinationZ_None_class =
12560                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
12561         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
12562         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
12563         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
12564 }
12565 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12566         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
12567         switch(obj->tag) {
12568                 case LDKCOption_HTLCDestinationZ_Some: {
12569                         int64_t some_ref = tag_ptr(&obj->some, false);
12570                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
12571                 }
12572                 case LDKCOption_HTLCDestinationZ_None: {
12573                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
12574                 }
12575                 default: abort();
12576         }
12577 }
12578 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12579 CHECK(owner->result_ok);
12580         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
12581 }
12582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12583         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12584         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12585         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
12586         int64_t ret_ref = tag_ptr(ret_copy, true);
12587         return ret_ref;
12588 }
12589
12590 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12591 CHECK(!owner->result_ok);
12592         return DecodeError_clone(&*owner->contents.err);
12593 }
12594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12595         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12596         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12597         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
12598         int64_t ret_ref = tag_ptr(ret_copy, true);
12599         return ret_ref;
12600 }
12601
12602 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12603 CHECK(owner->result_ok);
12604         return PaymentFailureReason_clone(&*owner->contents.result);
12605 }
12606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12607         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12608         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
12609         return ret_conv;
12610 }
12611
12612 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12613 CHECK(!owner->result_ok);
12614         return DecodeError_clone(&*owner->contents.err);
12615 }
12616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12617         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12619         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
12620         int64_t ret_ref = tag_ptr(ret_copy, true);
12621         return ret_ref;
12622 }
12623
12624 static jclass LDKCOption_U128Z_Some_class = NULL;
12625 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
12626 static jclass LDKCOption_U128Z_None_class = NULL;
12627 static jmethodID LDKCOption_U128Z_None_meth = NULL;
12628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
12629         LDKCOption_U128Z_Some_class =
12630                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
12631         CHECK(LDKCOption_U128Z_Some_class != NULL);
12632         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
12633         CHECK(LDKCOption_U128Z_Some_meth != NULL);
12634         LDKCOption_U128Z_None_class =
12635                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
12636         CHECK(LDKCOption_U128Z_None_class != NULL);
12637         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
12638         CHECK(LDKCOption_U128Z_None_meth != NULL);
12639 }
12640 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12641         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
12642         switch(obj->tag) {
12643                 case LDKCOption_U128Z_Some: {
12644                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
12645                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
12646                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
12647                 }
12648                 case LDKCOption_U128Z_None: {
12649                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
12650                 }
12651                 default: abort();
12652         }
12653 }
12654 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
12655         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
12656         for (size_t i = 0; i < ret.datalen; i++) {
12657                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
12658         }
12659         return ret;
12660 }
12661 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
12662 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
12663 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
12664 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
12665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
12666         LDKCOption_PaymentFailureReasonZ_Some_class =
12667                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
12668         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
12669         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
12670         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
12671         LDKCOption_PaymentFailureReasonZ_None_class =
12672                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
12673         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
12674         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
12675         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
12676 }
12677 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12678         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
12679         switch(obj->tag) {
12680                 case LDKCOption_PaymentFailureReasonZ_Some: {
12681                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
12682                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
12683                 }
12684                 case LDKCOption_PaymentFailureReasonZ_None: {
12685                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
12686                 }
12687                 default: abort();
12688         }
12689 }
12690 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
12691 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
12692 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
12693 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
12694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
12695         LDKBumpTransactionEvent_ChannelClose_class =
12696                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
12697         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
12698         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
12699         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
12700         LDKBumpTransactionEvent_HTLCResolution_class =
12701                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
12702         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
12703         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
12704         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
12705 }
12706 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12707         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
12708         switch(obj->tag) {
12709                 case LDKBumpTransactionEvent_ChannelClose: {
12710                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12711                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
12712                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
12713                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
12714                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
12715                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
12716                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
12717                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
12718                         int64_t anchor_descriptor_ref = 0;
12719                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
12720                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
12721                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
12722                         int64_tArray pending_htlcs_arr = NULL;
12723                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
12724                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
12725                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
12726                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
12727                                 int64_t pending_htlcs_conv_24_ref = 0;
12728                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
12729                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
12730                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
12731                         }
12732                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
12733                         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);
12734                 }
12735                 case LDKBumpTransactionEvent_HTLCResolution: {
12736                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12737                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
12738                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
12739                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
12740                         int64_tArray htlc_descriptors_arr = NULL;
12741                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
12742                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
12743                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
12744                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
12745                                 int64_t htlc_descriptors_conv_16_ref = 0;
12746                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
12747                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
12748                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
12749                         }
12750                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
12751                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
12752                         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);
12753                 }
12754                 default: abort();
12755         }
12756 }
12757 static jclass LDKEvent_FundingGenerationReady_class = NULL;
12758 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
12759 static jclass LDKEvent_PaymentClaimable_class = NULL;
12760 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
12761 static jclass LDKEvent_PaymentClaimed_class = NULL;
12762 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
12763 static jclass LDKEvent_PaymentSent_class = NULL;
12764 static jmethodID LDKEvent_PaymentSent_meth = NULL;
12765 static jclass LDKEvent_PaymentFailed_class = NULL;
12766 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
12767 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
12768 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
12769 static jclass LDKEvent_PaymentPathFailed_class = NULL;
12770 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
12771 static jclass LDKEvent_ProbeSuccessful_class = NULL;
12772 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
12773 static jclass LDKEvent_ProbeFailed_class = NULL;
12774 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
12775 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
12776 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
12777 static jclass LDKEvent_HTLCIntercepted_class = NULL;
12778 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
12779 static jclass LDKEvent_SpendableOutputs_class = NULL;
12780 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
12781 static jclass LDKEvent_PaymentForwarded_class = NULL;
12782 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
12783 static jclass LDKEvent_ChannelPending_class = NULL;
12784 static jmethodID LDKEvent_ChannelPending_meth = NULL;
12785 static jclass LDKEvent_ChannelReady_class = NULL;
12786 static jmethodID LDKEvent_ChannelReady_meth = NULL;
12787 static jclass LDKEvent_ChannelClosed_class = NULL;
12788 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
12789 static jclass LDKEvent_DiscardFunding_class = NULL;
12790 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
12791 static jclass LDKEvent_OpenChannelRequest_class = NULL;
12792 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
12793 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
12794 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
12795 static jclass LDKEvent_BumpTransaction_class = NULL;
12796 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
12797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
12798         LDKEvent_FundingGenerationReady_class =
12799                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
12800         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
12801         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
12802         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
12803         LDKEvent_PaymentClaimable_class =
12804                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
12805         CHECK(LDKEvent_PaymentClaimable_class != NULL);
12806         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
12807         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
12808         LDKEvent_PaymentClaimed_class =
12809                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
12810         CHECK(LDKEvent_PaymentClaimed_class != NULL);
12811         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
12812         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
12813         LDKEvent_PaymentSent_class =
12814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
12815         CHECK(LDKEvent_PaymentSent_class != NULL);
12816         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
12817         CHECK(LDKEvent_PaymentSent_meth != NULL);
12818         LDKEvent_PaymentFailed_class =
12819                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
12820         CHECK(LDKEvent_PaymentFailed_class != NULL);
12821         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
12822         CHECK(LDKEvent_PaymentFailed_meth != NULL);
12823         LDKEvent_PaymentPathSuccessful_class =
12824                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
12825         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
12826         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
12827         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
12828         LDKEvent_PaymentPathFailed_class =
12829                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
12830         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
12831         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
12832         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
12833         LDKEvent_ProbeSuccessful_class =
12834                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
12835         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
12836         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
12837         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
12838         LDKEvent_ProbeFailed_class =
12839                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
12840         CHECK(LDKEvent_ProbeFailed_class != NULL);
12841         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
12842         CHECK(LDKEvent_ProbeFailed_meth != NULL);
12843         LDKEvent_PendingHTLCsForwardable_class =
12844                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
12845         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
12846         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
12847         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
12848         LDKEvent_HTLCIntercepted_class =
12849                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
12850         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
12851         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
12852         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
12853         LDKEvent_SpendableOutputs_class =
12854                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
12855         CHECK(LDKEvent_SpendableOutputs_class != NULL);
12856         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
12857         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
12858         LDKEvent_PaymentForwarded_class =
12859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
12860         CHECK(LDKEvent_PaymentForwarded_class != NULL);
12861         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJZJ)V");
12862         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
12863         LDKEvent_ChannelPending_class =
12864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
12865         CHECK(LDKEvent_ChannelPending_class != NULL);
12866         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[BJ[BJ)V");
12867         CHECK(LDKEvent_ChannelPending_meth != NULL);
12868         LDKEvent_ChannelReady_class =
12869                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
12870         CHECK(LDKEvent_ChannelReady_class != NULL);
12871         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
12872         CHECK(LDKEvent_ChannelReady_meth != NULL);
12873         LDKEvent_ChannelClosed_class =
12874                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
12875         CHECK(LDKEvent_ChannelClosed_class != NULL);
12876         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ[BJ)V");
12877         CHECK(LDKEvent_ChannelClosed_meth != NULL);
12878         LDKEvent_DiscardFunding_class =
12879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
12880         CHECK(LDKEvent_DiscardFunding_class != NULL);
12881         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
12882         CHECK(LDKEvent_DiscardFunding_meth != NULL);
12883         LDKEvent_OpenChannelRequest_class =
12884                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
12885         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
12886         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
12887         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
12888         LDKEvent_HTLCHandlingFailed_class =
12889                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
12890         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
12891         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
12892         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
12893         LDKEvent_BumpTransaction_class =
12894                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
12895         CHECK(LDKEvent_BumpTransaction_class != NULL);
12896         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
12897         CHECK(LDKEvent_BumpTransaction_meth != NULL);
12898 }
12899 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12900         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12901         switch(obj->tag) {
12902                 case LDKEvent_FundingGenerationReady: {
12903                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12904                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
12905                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12906                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
12907                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
12908                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
12909                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
12910                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
12911                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12912                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
12913                         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);
12914                 }
12915                 case LDKEvent_PaymentClaimable: {
12916                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12917                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
12918                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12919                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
12920                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
12921                         int64_t onion_fields_ref = 0;
12922                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
12923                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
12924                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
12925                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
12926                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
12927                         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
12928                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
12929                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
12930                         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);
12931                 }
12932                 case LDKEvent_PaymentClaimed: {
12933                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12934                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
12935                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12936                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
12937                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
12938                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
12939                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
12940                         int64_tArray htlcs_arr = NULL;
12941                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
12942                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
12943                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
12944                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
12945                                 int64_t htlcs_conv_13_ref = 0;
12946                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
12947                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
12948                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
12949                         }
12950                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
12951                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
12952                         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);
12953                 }
12954                 case LDKEvent_PaymentSent: {
12955                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
12956                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
12957                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
12958                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12959                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
12960                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
12961                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
12962                 }
12963                 case LDKEvent_PaymentFailed: {
12964                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12965                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
12966                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12967                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
12968                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
12969                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
12970                 }
12971                 case LDKEvent_PaymentPathSuccessful: {
12972                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12973                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
12974                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
12975                         LDKPath path_var = obj->payment_path_successful.path;
12976                         int64_t path_ref = 0;
12977                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12978                         path_ref = tag_ptr(path_var.inner, false);
12979                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
12980                 }
12981                 case LDKEvent_PaymentPathFailed: {
12982                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
12983                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12984                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
12985                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
12986                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
12987                         LDKPath path_var = obj->payment_path_failed.path;
12988                         int64_t path_ref = 0;
12989                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12990                         path_ref = tag_ptr(path_var.inner, false);
12991                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
12992                         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);
12993                 }
12994                 case LDKEvent_ProbeSuccessful: {
12995                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12996                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
12997                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12998                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
12999                         LDKPath path_var = obj->probe_successful.path;
13000                         int64_t path_ref = 0;
13001                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13002                         path_ref = tag_ptr(path_var.inner, false);
13003                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
13004                 }
13005                 case LDKEvent_ProbeFailed: {
13006                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13007                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
13008                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13009                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
13010                         LDKPath path_var = obj->probe_failed.path;
13011                         int64_t path_ref = 0;
13012                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13013                         path_ref = tag_ptr(path_var.inner, false);
13014                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
13015                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
13016                 }
13017                 case LDKEvent_PendingHTLCsForwardable: {
13018                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
13019                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
13020                 }
13021                 case LDKEvent_HTLCIntercepted: {
13022                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
13023                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
13024                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
13025                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13026                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
13027                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
13028                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
13029                         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);
13030                 }
13031                 case LDKEvent_SpendableOutputs: {
13032                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
13033                         int64_tArray outputs_arr = NULL;
13034                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
13035                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
13036                         for (size_t b = 0; b < outputs_var.datalen; b++) {
13037                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
13038                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
13039                         }
13040                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
13041                         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
13042                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
13043                 }
13044                 case LDKEvent_PaymentForwarded: {
13045                         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
13046                         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
13047                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
13048                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
13049                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
13050                         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);
13051                 }
13052                 case LDKEvent_ChannelPending: {
13053                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13054                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
13055                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13056                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
13057                         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
13058                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13059                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
13060                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
13061                         int64_t funding_txo_ref = 0;
13062                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
13063                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
13064                         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);
13065                 }
13066                 case LDKEvent_ChannelReady: {
13067                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13068                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
13069                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13070                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
13071                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13072                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
13073                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
13074                         int64_t channel_type_ref = 0;
13075                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13076                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13077                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
13078                 }
13079                 case LDKEvent_ChannelClosed: {
13080                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13081                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
13082                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13083                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
13084                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
13085                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13086                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
13087                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
13088                         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);
13089                 }
13090                 case LDKEvent_DiscardFunding: {
13091                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13092                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
13093                         LDKTransaction transaction_var = obj->discard_funding.transaction;
13094                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
13095                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
13096                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
13097                 }
13098                 case LDKEvent_OpenChannelRequest: {
13099                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
13100                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
13101                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13102                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
13103                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
13104                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
13105                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
13106                         int64_t channel_type_ref = 0;
13107                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13108                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13109                         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);
13110                 }
13111                 case LDKEvent_HTLCHandlingFailed: {
13112                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
13113                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
13114                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
13115                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
13116                 }
13117                 case LDKEvent_BumpTransaction: {
13118                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
13119                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
13120                 }
13121                 default: abort();
13122         }
13123 }
13124 static jclass LDKCOption_EventZ_Some_class = NULL;
13125 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
13126 static jclass LDKCOption_EventZ_None_class = NULL;
13127 static jmethodID LDKCOption_EventZ_None_meth = NULL;
13128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
13129         LDKCOption_EventZ_Some_class =
13130                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
13131         CHECK(LDKCOption_EventZ_Some_class != NULL);
13132         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
13133         CHECK(LDKCOption_EventZ_Some_meth != NULL);
13134         LDKCOption_EventZ_None_class =
13135                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
13136         CHECK(LDKCOption_EventZ_None_class != NULL);
13137         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
13138         CHECK(LDKCOption_EventZ_None_meth != NULL);
13139 }
13140 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13141         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
13142         switch(obj->tag) {
13143                 case LDKCOption_EventZ_Some: {
13144                         int64_t some_ref = tag_ptr(&obj->some, false);
13145                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
13146                 }
13147                 case LDKCOption_EventZ_None: {
13148                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
13149                 }
13150                 default: abort();
13151         }
13152 }
13153 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13154 CHECK(owner->result_ok);
13155         return COption_EventZ_clone(&*owner->contents.result);
13156 }
13157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13158         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13159         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13160         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
13161         int64_t ret_ref = tag_ptr(ret_copy, true);
13162         return ret_ref;
13163 }
13164
13165 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13166 CHECK(!owner->result_ok);
13167         return DecodeError_clone(&*owner->contents.err);
13168 }
13169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13170         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13171         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13172         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
13173         int64_t ret_ref = tag_ptr(ret_copy, true);
13174         return ret_ref;
13175 }
13176
13177 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
13178 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
13179 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
13180 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
13181 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
13182 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
13183 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
13184 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
13185 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
13186 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
13187 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
13188 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
13189 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
13190 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
13191 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
13192 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
13193 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
13194 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
13195 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
13196 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
13197 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
13198 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
13199 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
13200 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
13201 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
13202 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
13203 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
13204 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
13205 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
13206 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
13207 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
13208 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
13209 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
13210 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
13211 static jclass LDKBolt11ParseError_Skip_class = NULL;
13212 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
13213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
13214         LDKBolt11ParseError_Bech32Error_class =
13215                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
13216         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
13217         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
13218         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
13219         LDKBolt11ParseError_ParseAmountError_class =
13220                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
13221         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
13222         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
13223         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
13224         LDKBolt11ParseError_MalformedSignature_class =
13225                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
13226         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
13227         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
13228         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
13229         LDKBolt11ParseError_BadPrefix_class =
13230                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
13231         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
13232         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
13233         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
13234         LDKBolt11ParseError_UnknownCurrency_class =
13235                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
13236         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
13237         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
13238         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
13239         LDKBolt11ParseError_UnknownSiPrefix_class =
13240                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
13241         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
13242         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
13243         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
13244         LDKBolt11ParseError_MalformedHRP_class =
13245                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
13246         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
13247         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
13248         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
13249         LDKBolt11ParseError_TooShortDataPart_class =
13250                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
13251         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
13252         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
13253         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
13254         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
13255                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
13256         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
13257         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
13258         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
13259         LDKBolt11ParseError_DescriptionDecodeError_class =
13260                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
13261         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
13262         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
13263         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
13264         LDKBolt11ParseError_PaddingError_class =
13265                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
13266         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
13267         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
13268         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
13269         LDKBolt11ParseError_IntegerOverflowError_class =
13270                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
13271         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
13272         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
13273         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
13274         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
13275                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
13276         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
13277         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
13278         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
13279         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
13280                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
13281         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
13282         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
13283         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
13284         LDKBolt11ParseError_InvalidScriptHashLength_class =
13285                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
13286         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
13287         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
13288         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
13289         LDKBolt11ParseError_InvalidRecoveryId_class =
13290                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
13291         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
13292         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
13293         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
13294         LDKBolt11ParseError_InvalidSliceLength_class =
13295                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
13296         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
13297         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
13298         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
13299         LDKBolt11ParseError_Skip_class =
13300                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
13301         CHECK(LDKBolt11ParseError_Skip_class != NULL);
13302         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
13303         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
13304 }
13305 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13306         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
13307         switch(obj->tag) {
13308                 case LDKBolt11ParseError_Bech32Error: {
13309                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
13310                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
13311                 }
13312                 case LDKBolt11ParseError_ParseAmountError: {
13313                         /*obj->parse_amount_error*/
13314                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
13315                 }
13316                 case LDKBolt11ParseError_MalformedSignature: {
13317                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
13318                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
13319                 }
13320                 case LDKBolt11ParseError_BadPrefix: {
13321                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
13322                 }
13323                 case LDKBolt11ParseError_UnknownCurrency: {
13324                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
13325                 }
13326                 case LDKBolt11ParseError_UnknownSiPrefix: {
13327                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
13328                 }
13329                 case LDKBolt11ParseError_MalformedHRP: {
13330                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
13331                 }
13332                 case LDKBolt11ParseError_TooShortDataPart: {
13333                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
13334                 }
13335                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
13336                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
13337                 }
13338                 case LDKBolt11ParseError_DescriptionDecodeError: {
13339                         /*obj->description_decode_error*/
13340                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
13341                 }
13342                 case LDKBolt11ParseError_PaddingError: {
13343                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
13344                 }
13345                 case LDKBolt11ParseError_IntegerOverflowError: {
13346                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
13347                 }
13348                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
13349                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
13350                 }
13351                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
13352                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
13353                 }
13354                 case LDKBolt11ParseError_InvalidScriptHashLength: {
13355                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
13356                 }
13357                 case LDKBolt11ParseError_InvalidRecoveryId: {
13358                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
13359                 }
13360                 case LDKBolt11ParseError_InvalidSliceLength: {
13361                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
13362                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
13363                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
13364                 }
13365                 case LDKBolt11ParseError_Skip: {
13366                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
13367                 }
13368                 default: abort();
13369         }
13370 }
13371 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13372 CHECK(owner->result_ok);
13373         return SiPrefix_clone(&*owner->contents.result);
13374 }
13375 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13376         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13377         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
13378         return ret_conv;
13379 }
13380
13381 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13382 CHECK(!owner->result_ok);
13383         return Bolt11ParseError_clone(&*owner->contents.err);
13384 }
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13386         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13387         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13388         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
13389         int64_t ret_ref = tag_ptr(ret_copy, true);
13390         return ret_ref;
13391 }
13392
13393 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
13394 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
13395 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
13396 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
13397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
13398         LDKParseOrSemanticError_ParseError_class =
13399                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
13400         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
13401         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
13402         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
13403         LDKParseOrSemanticError_SemanticError_class =
13404                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
13405         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
13406         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
13407         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
13408 }
13409 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13410         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
13411         switch(obj->tag) {
13412                 case LDKParseOrSemanticError_ParseError: {
13413                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
13414                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
13415                 }
13416                 case LDKParseOrSemanticError_SemanticError: {
13417                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
13418                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
13419                 }
13420                 default: abort();
13421         }
13422 }
13423 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13424         LDKBolt11Invoice ret = *owner->contents.result;
13425         ret.is_owned = false;
13426         return ret;
13427 }
13428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13429         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13430         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
13431         int64_t ret_ref = 0;
13432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13434         return ret_ref;
13435 }
13436
13437 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13438 CHECK(!owner->result_ok);
13439         return ParseOrSemanticError_clone(&*owner->contents.err);
13440 }
13441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13442         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13443         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
13444         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
13445         int64_t ret_ref = tag_ptr(ret_copy, true);
13446         return ret_ref;
13447 }
13448
13449 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13450         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
13451         ret.is_owned = false;
13452         return ret;
13453 }
13454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13455         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13456         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
13457         int64_t ret_ref = 0;
13458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13460         return ret_ref;
13461 }
13462
13463 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13464 CHECK(!owner->result_ok);
13465         return Bolt11ParseError_clone(&*owner->contents.err);
13466 }
13467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13468         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13469         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13470         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
13471         int64_t ret_ref = tag_ptr(ret_copy, true);
13472         return ret_ref;
13473 }
13474
13475 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13476         LDKRawBolt11Invoice ret = owner->a;
13477         ret.is_owned = false;
13478         return ret;
13479 }
13480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
13481         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13482         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
13483         int64_t ret_ref = 0;
13484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13486         return ret_ref;
13487 }
13488
13489 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13490         return ThirtyTwoBytes_clone(&owner->b);
13491 }
13492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
13493         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13494         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13495         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
13496         return ret_arr;
13497 }
13498
13499 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13500         LDKBolt11InvoiceSignature ret = owner->c;
13501         ret.is_owned = false;
13502         return ret;
13503 }
13504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
13505         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13506         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
13507         int64_t ret_ref = 0;
13508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13510         return ret_ref;
13511 }
13512
13513 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13514         LDKPayeePubKey ret = *owner->contents.result;
13515         ret.is_owned = false;
13516         return ret;
13517 }
13518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13519         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13520         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
13521         int64_t ret_ref = 0;
13522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13524         return ret_ref;
13525 }
13526
13527 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13528 CHECK(!owner->result_ok);
13529         return *owner->contents.err;
13530 }
13531 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13532         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13533         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
13534         return ret_conv;
13535 }
13536
13537 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
13538         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
13539         for (size_t i = 0; i < ret.datalen; i++) {
13540                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
13541         }
13542         return ret;
13543 }
13544 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13545         LDKPositiveTimestamp ret = *owner->contents.result;
13546         ret.is_owned = false;
13547         return ret;
13548 }
13549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13550         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13551         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
13552         int64_t ret_ref = 0;
13553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13555         return ret_ref;
13556 }
13557
13558 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13559 CHECK(!owner->result_ok);
13560         return CreationError_clone(&*owner->contents.err);
13561 }
13562 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13563         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13564         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
13565         return ret_conv;
13566 }
13567
13568 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13569 CHECK(owner->result_ok);
13570         return *owner->contents.result;
13571 }
13572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13573         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13574         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
13575 }
13576
13577 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13578 CHECK(!owner->result_ok);
13579         return Bolt11SemanticError_clone(&*owner->contents.err);
13580 }
13581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13582         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13583         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
13584         return ret_conv;
13585 }
13586
13587 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13588         LDKBolt11Invoice ret = *owner->contents.result;
13589         ret.is_owned = false;
13590         return ret;
13591 }
13592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13593         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13594         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
13595         int64_t ret_ref = 0;
13596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13598         return ret_ref;
13599 }
13600
13601 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13602 CHECK(!owner->result_ok);
13603         return Bolt11SemanticError_clone(&*owner->contents.err);
13604 }
13605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13606         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13607         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
13608         return ret_conv;
13609 }
13610
13611 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13612         LDKDescription ret = *owner->contents.result;
13613         ret.is_owned = false;
13614         return ret;
13615 }
13616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13617         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13618         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
13619         int64_t ret_ref = 0;
13620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13622         return ret_ref;
13623 }
13624
13625 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13626 CHECK(!owner->result_ok);
13627         return CreationError_clone(&*owner->contents.err);
13628 }
13629 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13630         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13631         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
13632         return ret_conv;
13633 }
13634
13635 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13636         LDKPrivateRoute ret = *owner->contents.result;
13637         ret.is_owned = false;
13638         return ret;
13639 }
13640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13641         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13642         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
13643         int64_t ret_ref = 0;
13644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13646         return ret_ref;
13647 }
13648
13649 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13650 CHECK(!owner->result_ok);
13651         return CreationError_clone(&*owner->contents.err);
13652 }
13653 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13654         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13655         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
13656         return ret_conv;
13657 }
13658
13659 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13660         LDKOutPoint ret = *owner->contents.result;
13661         ret.is_owned = false;
13662         return ret;
13663 }
13664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13665         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13666         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
13667         int64_t ret_ref = 0;
13668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13670         return ret_ref;
13671 }
13672
13673 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13674 CHECK(!owner->result_ok);
13675         return DecodeError_clone(&*owner->contents.err);
13676 }
13677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13678         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13679         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13680         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
13681         int64_t ret_ref = tag_ptr(ret_copy, true);
13682         return ret_ref;
13683 }
13684
13685 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13686         LDKBigSize ret = *owner->contents.result;
13687         ret.is_owned = false;
13688         return ret;
13689 }
13690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13691         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13692         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13693         int64_t ret_ref = 0;
13694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13696         return ret_ref;
13697 }
13698
13699 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13700 CHECK(!owner->result_ok);
13701         return DecodeError_clone(&*owner->contents.err);
13702 }
13703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13704         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13705         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13706         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13707         int64_t ret_ref = tag_ptr(ret_copy, true);
13708         return ret_ref;
13709 }
13710
13711 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13712         LDKHostname ret = *owner->contents.result;
13713         ret.is_owned = false;
13714         return ret;
13715 }
13716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13717         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13718         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13719         int64_t ret_ref = 0;
13720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13722         return ret_ref;
13723 }
13724
13725 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13726 CHECK(!owner->result_ok);
13727         return DecodeError_clone(&*owner->contents.err);
13728 }
13729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13730         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13731         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13732         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13733         int64_t ret_ref = tag_ptr(ret_copy, true);
13734         return ret_ref;
13735 }
13736
13737 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13738         LDKTransactionU16LenLimited ret = *owner->contents.result;
13739         ret.is_owned = false;
13740         return ret;
13741 }
13742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13743         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13744         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13745         int64_t ret_ref = 0;
13746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13748         return ret_ref;
13749 }
13750
13751 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13752 CHECK(!owner->result_ok);
13753         return *owner->contents.err;
13754 }
13755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13756         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13757         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13758 }
13759
13760 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13761         LDKTransactionU16LenLimited ret = *owner->contents.result;
13762         ret.is_owned = false;
13763         return ret;
13764 }
13765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13766         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13767         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13768         int64_t ret_ref = 0;
13769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13771         return ret_ref;
13772 }
13773
13774 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13775 CHECK(!owner->result_ok);
13776         return DecodeError_clone(&*owner->contents.err);
13777 }
13778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13779         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13780         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13781         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13782         int64_t ret_ref = tag_ptr(ret_copy, true);
13783         return ret_ref;
13784 }
13785
13786 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13787         LDKUntrustedString ret = *owner->contents.result;
13788         ret.is_owned = false;
13789         return ret;
13790 }
13791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13792         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13793         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
13794         int64_t ret_ref = 0;
13795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13797         return ret_ref;
13798 }
13799
13800 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13801 CHECK(!owner->result_ok);
13802         return DecodeError_clone(&*owner->contents.err);
13803 }
13804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13805         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13806         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13807         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
13808         int64_t ret_ref = tag_ptr(ret_copy, true);
13809         return ret_ref;
13810 }
13811
13812 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
13813         LDKReceiveTlvs ret = *owner->contents.result;
13814         ret.is_owned = false;
13815         return ret;
13816 }
13817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13818         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
13819         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
13820         int64_t ret_ref = 0;
13821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13823         return ret_ref;
13824 }
13825
13826 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
13827 CHECK(!owner->result_ok);
13828         return DecodeError_clone(&*owner->contents.err);
13829 }
13830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13831         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
13832         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13833         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
13834         int64_t ret_ref = tag_ptr(ret_copy, true);
13835         return ret_ref;
13836 }
13837
13838 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13839         LDKPaymentRelay ret = *owner->contents.result;
13840         ret.is_owned = false;
13841         return ret;
13842 }
13843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13844         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13845         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
13846         int64_t ret_ref = 0;
13847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13849         return ret_ref;
13850 }
13851
13852 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13853 CHECK(!owner->result_ok);
13854         return DecodeError_clone(&*owner->contents.err);
13855 }
13856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13857         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13858         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13859         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
13860         int64_t ret_ref = tag_ptr(ret_copy, true);
13861         return ret_ref;
13862 }
13863
13864 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13865         LDKPaymentConstraints ret = *owner->contents.result;
13866         ret.is_owned = false;
13867         return ret;
13868 }
13869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13870         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13871         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
13872         int64_t ret_ref = 0;
13873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13875         return ret_ref;
13876 }
13877
13878 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13879 CHECK(!owner->result_ok);
13880         return DecodeError_clone(&*owner->contents.err);
13881 }
13882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13883         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13885         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
13886         int64_t ret_ref = tag_ptr(ret_copy, true);
13887         return ret_ref;
13888 }
13889
13890 static jclass LDKPaymentError_Invoice_class = NULL;
13891 static jmethodID LDKPaymentError_Invoice_meth = NULL;
13892 static jclass LDKPaymentError_Sending_class = NULL;
13893 static jmethodID LDKPaymentError_Sending_meth = NULL;
13894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
13895         LDKPaymentError_Invoice_class =
13896                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
13897         CHECK(LDKPaymentError_Invoice_class != NULL);
13898         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
13899         CHECK(LDKPaymentError_Invoice_meth != NULL);
13900         LDKPaymentError_Sending_class =
13901                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
13902         CHECK(LDKPaymentError_Sending_class != NULL);
13903         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
13904         CHECK(LDKPaymentError_Sending_meth != NULL);
13905 }
13906 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13907         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
13908         switch(obj->tag) {
13909                 case LDKPaymentError_Invoice: {
13910                         LDKStr invoice_str = obj->invoice;
13911                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
13912                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
13913                 }
13914                 case LDKPaymentError_Sending: {
13915                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
13916                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
13917                 }
13918                 default: abort();
13919         }
13920 }
13921 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
13922 CHECK(owner->result_ok);
13923         return ThirtyTwoBytes_clone(&*owner->contents.result);
13924 }
13925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13926         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
13927         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13928         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data);
13929         return ret_arr;
13930 }
13931
13932 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
13933 CHECK(!owner->result_ok);
13934         return PaymentError_clone(&*owner->contents.err);
13935 }
13936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13937         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
13938         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13939         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
13940         int64_t ret_ref = tag_ptr(ret_copy, true);
13941         return ret_ref;
13942 }
13943
13944 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13945 CHECK(owner->result_ok);
13946         return *owner->contents.result;
13947 }
13948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13949         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13950         CResult_NonePaymentErrorZ_get_ok(owner_conv);
13951 }
13952
13953 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13954 CHECK(!owner->result_ok);
13955         return PaymentError_clone(&*owner->contents.err);
13956 }
13957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13958         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13959         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13960         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
13961         int64_t ret_ref = tag_ptr(ret_copy, true);
13962         return ret_ref;
13963 }
13964
13965 static jclass LDKProbingError_Invoice_class = NULL;
13966 static jmethodID LDKProbingError_Invoice_meth = NULL;
13967 static jclass LDKProbingError_Sending_class = NULL;
13968 static jmethodID LDKProbingError_Sending_meth = NULL;
13969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbingError_init (JNIEnv *env, jclass clz) {
13970         LDKProbingError_Invoice_class =
13971                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Invoice"));
13972         CHECK(LDKProbingError_Invoice_class != NULL);
13973         LDKProbingError_Invoice_meth = (*env)->GetMethodID(env, LDKProbingError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
13974         CHECK(LDKProbingError_Invoice_meth != NULL);
13975         LDKProbingError_Sending_class =
13976                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Sending"));
13977         CHECK(LDKProbingError_Sending_class != NULL);
13978         LDKProbingError_Sending_meth = (*env)->GetMethodID(env, LDKProbingError_Sending_class, "<init>", "(J)V");
13979         CHECK(LDKProbingError_Sending_meth != NULL);
13980 }
13981 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbingError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13982         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
13983         switch(obj->tag) {
13984                 case LDKProbingError_Invoice: {
13985                         LDKStr invoice_str = obj->invoice;
13986                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
13987                         return (*env)->NewObject(env, LDKProbingError_Invoice_class, LDKProbingError_Invoice_meth, invoice_conv);
13988                 }
13989                 case LDKProbingError_Sending: {
13990                         int64_t sending_ref = tag_ptr(&obj->sending, false);
13991                         return (*env)->NewObject(env, LDKProbingError_Sending_class, LDKProbingError_Sending_meth, sending_ref);
13992                 }
13993                 default: abort();
13994         }
13995 }
13996 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
13997 CHECK(owner->result_ok);
13998         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
13999 }
14000 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14001         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14002         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
14003         int64_tArray ret_arr = NULL;
14004         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14005         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14006         for (size_t o = 0; o < ret_var.datalen; o++) {
14007                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
14008                 *ret_conv_40_conv = ret_var.data[o];
14009                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
14010         }
14011         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14012         FREE(ret_var.data);
14013         return ret_arr;
14014 }
14015
14016 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14017 CHECK(!owner->result_ok);
14018         return ProbingError_clone(&*owner->contents.err);
14019 }
14020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14021         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14022         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
14023         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
14024         int64_t ret_ref = tag_ptr(ret_copy, true);
14025         return ret_ref;
14026 }
14027
14028 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14029 CHECK(owner->result_ok);
14030         return *owner->contents.result;
14031 }
14032 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14033         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14034         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
14035         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14036         return ret_conv;
14037 }
14038
14039 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14040 CHECK(!owner->result_ok);
14041         return *owner->contents.err;
14042 }
14043 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14044         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14045         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
14046         return ret_conv;
14047 }
14048
14049 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14050         LDKOnionMessagePath ret = *owner->contents.result;
14051         ret.is_owned = false;
14052         return ret;
14053 }
14054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14055         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14056         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
14057         int64_t ret_ref = 0;
14058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14060         return ret_ref;
14061 }
14062
14063 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14064 CHECK(!owner->result_ok);
14065         return *owner->contents.err;
14066 }
14067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14068         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14069         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
14070 }
14071
14072 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14073         return owner->a;
14074 }
14075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14076         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14077         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14078         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form);
14079         return ret_arr;
14080 }
14081
14082 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14083         LDKOnionMessage ret = owner->b;
14084         ret.is_owned = false;
14085         return ret;
14086 }
14087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14088         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14089         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
14090         int64_t ret_ref = 0;
14091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14093         return ret_ref;
14094 }
14095
14096 static jclass LDKSendError_Secp256k1_class = NULL;
14097 static jmethodID LDKSendError_Secp256k1_meth = NULL;
14098 static jclass LDKSendError_TooBigPacket_class = NULL;
14099 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
14100 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
14101 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
14102 static jclass LDKSendError_InvalidFirstHop_class = NULL;
14103 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
14104 static jclass LDKSendError_InvalidMessage_class = NULL;
14105 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
14106 static jclass LDKSendError_BufferFull_class = NULL;
14107 static jmethodID LDKSendError_BufferFull_meth = NULL;
14108 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
14109 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
14110 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
14111 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
14112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
14113         LDKSendError_Secp256k1_class =
14114                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
14115         CHECK(LDKSendError_Secp256k1_class != NULL);
14116         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
14117         CHECK(LDKSendError_Secp256k1_meth != NULL);
14118         LDKSendError_TooBigPacket_class =
14119                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
14120         CHECK(LDKSendError_TooBigPacket_class != NULL);
14121         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
14122         CHECK(LDKSendError_TooBigPacket_meth != NULL);
14123         LDKSendError_TooFewBlindedHops_class =
14124                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
14125         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
14126         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
14127         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
14128         LDKSendError_InvalidFirstHop_class =
14129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
14130         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
14131         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
14132         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
14133         LDKSendError_InvalidMessage_class =
14134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
14135         CHECK(LDKSendError_InvalidMessage_class != NULL);
14136         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
14137         CHECK(LDKSendError_InvalidMessage_meth != NULL);
14138         LDKSendError_BufferFull_class =
14139                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
14140         CHECK(LDKSendError_BufferFull_class != NULL);
14141         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
14142         CHECK(LDKSendError_BufferFull_meth != NULL);
14143         LDKSendError_GetNodeIdFailed_class =
14144                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
14145         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
14146         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
14147         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
14148         LDKSendError_BlindedPathAdvanceFailed_class =
14149                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
14150         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
14151         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
14152         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
14153 }
14154 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14155         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
14156         switch(obj->tag) {
14157                 case LDKSendError_Secp256k1: {
14158                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
14159                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
14160                 }
14161                 case LDKSendError_TooBigPacket: {
14162                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
14163                 }
14164                 case LDKSendError_TooFewBlindedHops: {
14165                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
14166                 }
14167                 case LDKSendError_InvalidFirstHop: {
14168                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
14169                 }
14170                 case LDKSendError_InvalidMessage: {
14171                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
14172                 }
14173                 case LDKSendError_BufferFull: {
14174                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
14175                 }
14176                 case LDKSendError_GetNodeIdFailed: {
14177                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
14178                 }
14179                 case LDKSendError_BlindedPathAdvanceFailed: {
14180                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
14181                 }
14182                 default: abort();
14183         }
14184 }
14185 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14186 CHECK(owner->result_ok);
14187         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
14188 }
14189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14190         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14191         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
14192         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
14193         return tag_ptr(ret_conv, true);
14194 }
14195
14196 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14197 CHECK(!owner->result_ok);
14198         return SendError_clone(&*owner->contents.err);
14199 }
14200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14201         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14202         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14203         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
14204         int64_t ret_ref = tag_ptr(ret_copy, true);
14205         return ret_ref;
14206 }
14207
14208 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14209 CHECK(owner->result_ok);
14210         return *owner->contents.result;
14211 }
14212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14213         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14214         CResult_NoneSendErrorZ_get_ok(owner_conv);
14215 }
14216
14217 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14218 CHECK(!owner->result_ok);
14219         return SendError_clone(&*owner->contents.err);
14220 }
14221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14222         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14223         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14224         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
14225         int64_t ret_ref = tag_ptr(ret_copy, true);
14226         return ret_ref;
14227 }
14228
14229 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14230         LDKBlindedPath ret = *owner->contents.result;
14231         ret.is_owned = false;
14232         return ret;
14233 }
14234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14235         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14236         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
14237         int64_t ret_ref = 0;
14238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14240         return ret_ref;
14241 }
14242
14243 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14244 CHECK(!owner->result_ok);
14245         return *owner->contents.err;
14246 }
14247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14248         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14249         CResult_BlindedPathNoneZ_get_err(owner_conv);
14250 }
14251
14252 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14253 CHECK(owner->result_ok);
14254         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
14255 }
14256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14257         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14258         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14259         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
14260         return tag_ptr(ret_conv, true);
14261 }
14262
14263 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14264 CHECK(!owner->result_ok);
14265         return *owner->contents.err;
14266 }
14267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14268         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14269         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
14270 }
14271
14272 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14273         LDKBlindedPath ret = *owner->contents.result;
14274         ret.is_owned = false;
14275         return ret;
14276 }
14277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14278         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14279         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
14280         int64_t ret_ref = 0;
14281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14283         return ret_ref;
14284 }
14285
14286 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14287 CHECK(!owner->result_ok);
14288         return DecodeError_clone(&*owner->contents.err);
14289 }
14290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14291         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14292         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14293         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
14294         int64_t ret_ref = tag_ptr(ret_copy, true);
14295         return ret_ref;
14296 }
14297
14298 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14299         LDKBlindedHop ret = *owner->contents.result;
14300         ret.is_owned = false;
14301         return ret;
14302 }
14303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14304         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14305         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
14306         int64_t ret_ref = 0;
14307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14309         return ret_ref;
14310 }
14311
14312 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14313 CHECK(!owner->result_ok);
14314         return DecodeError_clone(&*owner->contents.err);
14315 }
14316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14317         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14319         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
14320         int64_t ret_ref = tag_ptr(ret_copy, true);
14321         return ret_ref;
14322 }
14323
14324 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14325         LDKInvoiceError ret = *owner->contents.result;
14326         ret.is_owned = false;
14327         return ret;
14328 }
14329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14330         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14331         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
14332         int64_t ret_ref = 0;
14333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14335         return ret_ref;
14336 }
14337
14338 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14339 CHECK(!owner->result_ok);
14340         return DecodeError_clone(&*owner->contents.err);
14341 }
14342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14343         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14344         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14345         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
14346         int64_t ret_ref = tag_ptr(ret_copy, true);
14347         return ret_ref;
14348 }
14349
14350 typedef struct LDKFilter_JCalls {
14351         atomic_size_t refcnt;
14352         JavaVM *vm;
14353         jweak o;
14354         jmethodID register_tx_meth;
14355         jmethodID register_output_meth;
14356 } LDKFilter_JCalls;
14357 static void LDKFilter_JCalls_free(void* this_arg) {
14358         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14359         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14360                 JNIEnv *env;
14361                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14362                 if (get_jenv_res == JNI_EDETACHED) {
14363                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14364                 } else {
14365                         DO_ASSERT(get_jenv_res == JNI_OK);
14366                 }
14367                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14368                 if (get_jenv_res == JNI_EDETACHED) {
14369                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14370                 }
14371                 FREE(j_calls);
14372         }
14373 }
14374 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
14375         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14376         JNIEnv *env;
14377         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14378         if (get_jenv_res == JNI_EDETACHED) {
14379                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14380         } else {
14381                 DO_ASSERT(get_jenv_res == JNI_OK);
14382         }
14383         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
14384         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
14385         LDKu8slice script_pubkey_var = script_pubkey;
14386         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
14387         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
14388         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14389         CHECK(obj != NULL);
14390         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
14391         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14392                 (*env)->ExceptionDescribe(env);
14393                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
14394         }
14395         if (get_jenv_res == JNI_EDETACHED) {
14396                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14397         }
14398 }
14399 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
14400         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14401         JNIEnv *env;
14402         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14403         if (get_jenv_res == JNI_EDETACHED) {
14404                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14405         } else {
14406                 DO_ASSERT(get_jenv_res == JNI_OK);
14407         }
14408         LDKWatchedOutput output_var = output;
14409         int64_t output_ref = 0;
14410         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
14411         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
14412         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14413         CHECK(obj != NULL);
14414         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
14415         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14416                 (*env)->ExceptionDescribe(env);
14417                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
14418         }
14419         if (get_jenv_res == JNI_EDETACHED) {
14420                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14421         }
14422 }
14423 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
14424         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
14425         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14426 }
14427 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
14428         jclass c = (*env)->GetObjectClass(env, o);
14429         CHECK(c != NULL);
14430         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
14431         atomic_init(&calls->refcnt, 1);
14432         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14433         calls->o = (*env)->NewWeakGlobalRef(env, o);
14434         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
14435         CHECK(calls->register_tx_meth != NULL);
14436         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
14437         CHECK(calls->register_output_meth != NULL);
14438
14439         LDKFilter ret = {
14440                 .this_arg = (void*) calls,
14441                 .register_tx = register_tx_LDKFilter_jcall,
14442                 .register_output = register_output_LDKFilter_jcall,
14443                 .free = LDKFilter_JCalls_free,
14444         };
14445         return ret;
14446 }
14447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
14448         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14449         *res_ptr = LDKFilter_init(env, clz, o);
14450         return tag_ptr(res_ptr, true);
14451 }
14452 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) {
14453         void* this_arg_ptr = untag_ptr(this_arg);
14454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14455         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14456         uint8_t txid_arr[32];
14457         CHECK((*env)->GetArrayLength(env, txid) == 32);
14458         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14459         uint8_t (*txid_ref)[32] = &txid_arr;
14460         LDKu8slice script_pubkey_ref;
14461         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14462         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
14463         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
14464         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
14465 }
14466
14467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
14468         void* this_arg_ptr = untag_ptr(this_arg);
14469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14470         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14471         LDKWatchedOutput output_conv;
14472         output_conv.inner = untag_ptr(output);
14473         output_conv.is_owned = ptr_is_owned(output);
14474         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
14475         output_conv = WatchedOutput_clone(&output_conv);
14476         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
14477 }
14478
14479 static jclass LDKCOption_FilterZ_Some_class = NULL;
14480 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
14481 static jclass LDKCOption_FilterZ_None_class = NULL;
14482 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
14483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
14484         LDKCOption_FilterZ_Some_class =
14485                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
14486         CHECK(LDKCOption_FilterZ_Some_class != NULL);
14487         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
14488         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
14489         LDKCOption_FilterZ_None_class =
14490                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
14491         CHECK(LDKCOption_FilterZ_None_class != NULL);
14492         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
14493         CHECK(LDKCOption_FilterZ_None_meth != NULL);
14494 }
14495 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14496         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
14497         switch(obj->tag) {
14498                 case LDKCOption_FilterZ_Some: {
14499                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
14500                         *some_ret = obj->some;
14501                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
14502                         if ((*some_ret).free == LDKFilter_JCalls_free) {
14503                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14504                                 LDKFilter_JCalls_cloned(&(*some_ret));
14505                         }
14506                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
14507                 }
14508                 case LDKCOption_FilterZ_None: {
14509                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
14510                 }
14511                 default: abort();
14512         }
14513 }
14514 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14515         LDKLockedChannelMonitor ret = *owner->contents.result;
14516         ret.is_owned = false;
14517         return ret;
14518 }
14519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14520         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14521         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
14522         int64_t ret_ref = 0;
14523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14525         return ret_ref;
14526 }
14527
14528 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14529 CHECK(!owner->result_ok);
14530         return *owner->contents.err;
14531 }
14532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14533         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14534         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
14535 }
14536
14537 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
14538         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
14539         for (size_t i = 0; i < ret.datalen; i++) {
14540                 ret.data[i] = OutPoint_clone(&orig->data[i]);
14541         }
14542         return ret;
14543 }
14544 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
14545         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
14546         for (size_t i = 0; i < ret.datalen; i++) {
14547                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
14548         }
14549         return ret;
14550 }
14551 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14552         LDKOutPoint ret = owner->a;
14553         ret.is_owned = false;
14554         return ret;
14555 }
14556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14557         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14558         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
14559         int64_t ret_ref = 0;
14560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14562         return ret_ref;
14563 }
14564
14565 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14566         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14567 }
14568 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14569         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14570         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14571         int64_tArray ret_arr = NULL;
14572         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14573         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14574         for (size_t r = 0; r < ret_var.datalen; r++) {
14575                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14576                 int64_t ret_conv_17_ref = 0;
14577                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14578                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14579                 ret_arr_ptr[r] = ret_conv_17_ref;
14580         }
14581         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14582         FREE(ret_var.data);
14583         return ret_arr;
14584 }
14585
14586 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14587         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14588         for (size_t i = 0; i < ret.datalen; i++) {
14589                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14590         }
14591         return ret;
14592 }
14593 typedef struct LDKKVStore_JCalls {
14594         atomic_size_t refcnt;
14595         JavaVM *vm;
14596         jweak o;
14597         jmethodID read_meth;
14598         jmethodID write_meth;
14599         jmethodID remove_meth;
14600         jmethodID list_meth;
14601 } LDKKVStore_JCalls;
14602 static void LDKKVStore_JCalls_free(void* this_arg) {
14603         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14604         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14605                 JNIEnv *env;
14606                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14607                 if (get_jenv_res == JNI_EDETACHED) {
14608                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14609                 } else {
14610                         DO_ASSERT(get_jenv_res == JNI_OK);
14611                 }
14612                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14613                 if (get_jenv_res == JNI_EDETACHED) {
14614                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14615                 }
14616                 FREE(j_calls);
14617         }
14618 }
14619 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
14620         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14621         JNIEnv *env;
14622         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14623         if (get_jenv_res == JNI_EDETACHED) {
14624                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14625         } else {
14626                 DO_ASSERT(get_jenv_res == JNI_OK);
14627         }
14628         LDKStr primary_namespace_str = primary_namespace;
14629         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14630         Str_free(primary_namespace_str);
14631         LDKStr secondary_namespace_str = secondary_namespace;
14632         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14633         Str_free(secondary_namespace_str);
14634         LDKStr key_str = key;
14635         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14636         Str_free(key_str);
14637         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14638         CHECK(obj != NULL);
14639         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
14640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14641                 (*env)->ExceptionDescribe(env);
14642                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
14643         }
14644         void* ret_ptr = untag_ptr(ret);
14645         CHECK_ACCESS(ret_ptr);
14646         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
14647         FREE(untag_ptr(ret));
14648         if (get_jenv_res == JNI_EDETACHED) {
14649                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14650         }
14651         return ret_conv;
14652 }
14653 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
14654         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14655         JNIEnv *env;
14656         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14657         if (get_jenv_res == JNI_EDETACHED) {
14658                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14659         } else {
14660                 DO_ASSERT(get_jenv_res == JNI_OK);
14661         }
14662         LDKStr primary_namespace_str = primary_namespace;
14663         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14664         Str_free(primary_namespace_str);
14665         LDKStr secondary_namespace_str = secondary_namespace;
14666         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14667         Str_free(secondary_namespace_str);
14668         LDKStr key_str = key;
14669         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14670         Str_free(key_str);
14671         LDKu8slice buf_var = buf;
14672         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
14673         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
14674         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14675         CHECK(obj != NULL);
14676         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
14677         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14678                 (*env)->ExceptionDescribe(env);
14679                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
14680         }
14681         void* ret_ptr = untag_ptr(ret);
14682         CHECK_ACCESS(ret_ptr);
14683         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14684         FREE(untag_ptr(ret));
14685         if (get_jenv_res == JNI_EDETACHED) {
14686                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14687         }
14688         return ret_conv;
14689 }
14690 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
14691         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14692         JNIEnv *env;
14693         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14694         if (get_jenv_res == JNI_EDETACHED) {
14695                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14696         } else {
14697                 DO_ASSERT(get_jenv_res == JNI_OK);
14698         }
14699         LDKStr primary_namespace_str = primary_namespace;
14700         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14701         Str_free(primary_namespace_str);
14702         LDKStr secondary_namespace_str = secondary_namespace;
14703         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14704         Str_free(secondary_namespace_str);
14705         LDKStr key_str = key;
14706         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14707         Str_free(key_str);
14708         jboolean lazy_conv = lazy;
14709         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14710         CHECK(obj != NULL);
14711         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
14712         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14713                 (*env)->ExceptionDescribe(env);
14714                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
14715         }
14716         void* ret_ptr = untag_ptr(ret);
14717         CHECK_ACCESS(ret_ptr);
14718         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14719         FREE(untag_ptr(ret));
14720         if (get_jenv_res == JNI_EDETACHED) {
14721                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14722         }
14723         return ret_conv;
14724 }
14725 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
14726         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14727         JNIEnv *env;
14728         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14729         if (get_jenv_res == JNI_EDETACHED) {
14730                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14731         } else {
14732                 DO_ASSERT(get_jenv_res == JNI_OK);
14733         }
14734         LDKStr primary_namespace_str = primary_namespace;
14735         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14736         Str_free(primary_namespace_str);
14737         LDKStr secondary_namespace_str = secondary_namespace;
14738         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14739         Str_free(secondary_namespace_str);
14740         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14741         CHECK(obj != NULL);
14742         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
14743         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14744                 (*env)->ExceptionDescribe(env);
14745                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
14746         }
14747         void* ret_ptr = untag_ptr(ret);
14748         CHECK_ACCESS(ret_ptr);
14749         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
14750         FREE(untag_ptr(ret));
14751         if (get_jenv_res == JNI_EDETACHED) {
14752                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14753         }
14754         return ret_conv;
14755 }
14756 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
14757         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
14758         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14759 }
14760 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
14761         jclass c = (*env)->GetObjectClass(env, o);
14762         CHECK(c != NULL);
14763         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
14764         atomic_init(&calls->refcnt, 1);
14765         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14766         calls->o = (*env)->NewWeakGlobalRef(env, o);
14767         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
14768         CHECK(calls->read_meth != NULL);
14769         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
14770         CHECK(calls->write_meth != NULL);
14771         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
14772         CHECK(calls->remove_meth != NULL);
14773         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
14774         CHECK(calls->list_meth != NULL);
14775
14776         LDKKVStore ret = {
14777                 .this_arg = (void*) calls,
14778                 .read = read_LDKKVStore_jcall,
14779                 .write = write_LDKKVStore_jcall,
14780                 .remove = remove_LDKKVStore_jcall,
14781                 .list = list_LDKKVStore_jcall,
14782                 .free = LDKKVStore_JCalls_free,
14783         };
14784         return ret;
14785 }
14786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
14787         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
14788         *res_ptr = LDKKVStore_init(env, clz, o);
14789         return tag_ptr(res_ptr, true);
14790 }
14791 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) {
14792         void* this_arg_ptr = untag_ptr(this_arg);
14793         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14794         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14795         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14796         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14797         LDKStr key_conv = java_to_owned_str(env, key);
14798         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
14799         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
14800         return tag_ptr(ret_conv, true);
14801 }
14802
14803 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) {
14804         void* this_arg_ptr = untag_ptr(this_arg);
14805         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14806         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14807         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14808         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14809         LDKStr key_conv = java_to_owned_str(env, key);
14810         LDKu8slice buf_ref;
14811         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
14812         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
14813         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14814         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
14815         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
14816         return tag_ptr(ret_conv, true);
14817 }
14818
14819 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) {
14820         void* this_arg_ptr = untag_ptr(this_arg);
14821         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14822         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14823         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14824         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14825         LDKStr key_conv = java_to_owned_str(env, key);
14826         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14827         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
14828         return tag_ptr(ret_conv, true);
14829 }
14830
14831 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) {
14832         void* this_arg_ptr = untag_ptr(this_arg);
14833         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14834         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14835         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14836         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14837         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
14838         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
14839         return tag_ptr(ret_conv, true);
14840 }
14841
14842 typedef struct LDKPersister_JCalls {
14843         atomic_size_t refcnt;
14844         JavaVM *vm;
14845         jweak o;
14846         jmethodID persist_manager_meth;
14847         jmethodID persist_graph_meth;
14848         jmethodID persist_scorer_meth;
14849 } LDKPersister_JCalls;
14850 static void LDKPersister_JCalls_free(void* this_arg) {
14851         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14852         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14853                 JNIEnv *env;
14854                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14855                 if (get_jenv_res == JNI_EDETACHED) {
14856                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14857                 } else {
14858                         DO_ASSERT(get_jenv_res == JNI_OK);
14859                 }
14860                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14861                 if (get_jenv_res == JNI_EDETACHED) {
14862                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14863                 }
14864                 FREE(j_calls);
14865         }
14866 }
14867 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14868         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14869         JNIEnv *env;
14870         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14871         if (get_jenv_res == JNI_EDETACHED) {
14872                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14873         } else {
14874                 DO_ASSERT(get_jenv_res == JNI_OK);
14875         }
14876         LDKChannelManager channel_manager_var = *channel_manager;
14877         int64_t channel_manager_ref = 0;
14878         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14879         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14880         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14881         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14882         CHECK(obj != NULL);
14883         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
14884         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14885                 (*env)->ExceptionDescribe(env);
14886                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
14887         }
14888         void* ret_ptr = untag_ptr(ret);
14889         CHECK_ACCESS(ret_ptr);
14890         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14891         FREE(untag_ptr(ret));
14892         if (get_jenv_res == JNI_EDETACHED) {
14893                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14894         }
14895         return ret_conv;
14896 }
14897 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14898         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14899         JNIEnv *env;
14900         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14901         if (get_jenv_res == JNI_EDETACHED) {
14902                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14903         } else {
14904                 DO_ASSERT(get_jenv_res == JNI_OK);
14905         }
14906         LDKNetworkGraph network_graph_var = *network_graph;
14907         int64_t network_graph_ref = 0;
14908         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14909         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14910         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14911         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14912         CHECK(obj != NULL);
14913         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
14914         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14915                 (*env)->ExceptionDescribe(env);
14916                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
14917         }
14918         void* ret_ptr = untag_ptr(ret);
14919         CHECK_ACCESS(ret_ptr);
14920         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14921         FREE(untag_ptr(ret));
14922         if (get_jenv_res == JNI_EDETACHED) {
14923                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14924         }
14925         return ret_conv;
14926 }
14927 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14928         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14929         JNIEnv *env;
14930         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14931         if (get_jenv_res == JNI_EDETACHED) {
14932                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14933         } else {
14934                 DO_ASSERT(get_jenv_res == JNI_OK);
14935         }
14936         // WARNING: This object doesn't live past this scope, needs clone!
14937         int64_t ret_scorer = tag_ptr(scorer, false);
14938         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14939         CHECK(obj != NULL);
14940         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
14941         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14942                 (*env)->ExceptionDescribe(env);
14943                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
14944         }
14945         void* ret_ptr = untag_ptr(ret);
14946         CHECK_ACCESS(ret_ptr);
14947         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14948         FREE(untag_ptr(ret));
14949         if (get_jenv_res == JNI_EDETACHED) {
14950                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14951         }
14952         return ret_conv;
14953 }
14954 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14955         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14956         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14957 }
14958 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
14959         jclass c = (*env)->GetObjectClass(env, o);
14960         CHECK(c != NULL);
14961         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14962         atomic_init(&calls->refcnt, 1);
14963         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14964         calls->o = (*env)->NewWeakGlobalRef(env, o);
14965         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
14966         CHECK(calls->persist_manager_meth != NULL);
14967         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
14968         CHECK(calls->persist_graph_meth != NULL);
14969         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
14970         CHECK(calls->persist_scorer_meth != NULL);
14971
14972         LDKPersister ret = {
14973                 .this_arg = (void*) calls,
14974                 .persist_manager = persist_manager_LDKPersister_jcall,
14975                 .persist_graph = persist_graph_LDKPersister_jcall,
14976                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14977                 .free = LDKPersister_JCalls_free,
14978         };
14979         return ret;
14980 }
14981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
14982         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14983         *res_ptr = LDKPersister_init(env, clz, o);
14984         return tag_ptr(res_ptr, true);
14985 }
14986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
14987         void* this_arg_ptr = untag_ptr(this_arg);
14988         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14989         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14990         LDKChannelManager channel_manager_conv;
14991         channel_manager_conv.inner = untag_ptr(channel_manager);
14992         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14993         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14994         channel_manager_conv.is_owned = false;
14995         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14996         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14997         return tag_ptr(ret_conv, true);
14998 }
14999
15000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
15001         void* this_arg_ptr = untag_ptr(this_arg);
15002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15003         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15004         LDKNetworkGraph network_graph_conv;
15005         network_graph_conv.inner = untag_ptr(network_graph);
15006         network_graph_conv.is_owned = ptr_is_owned(network_graph);
15007         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
15008         network_graph_conv.is_owned = false;
15009         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15010         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
15011         return tag_ptr(ret_conv, true);
15012 }
15013
15014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
15015         void* this_arg_ptr = untag_ptr(this_arg);
15016         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15017         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15018         void* scorer_ptr = untag_ptr(scorer);
15019         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
15020         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
15021         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15022         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
15023         return tag_ptr(ret_conv, true);
15024 }
15025
15026 typedef struct LDKPersist_JCalls {
15027         atomic_size_t refcnt;
15028         JavaVM *vm;
15029         jweak o;
15030         jmethodID persist_new_channel_meth;
15031         jmethodID update_persisted_channel_meth;
15032 } LDKPersist_JCalls;
15033 static void LDKPersist_JCalls_free(void* this_arg) {
15034         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15035         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15036                 JNIEnv *env;
15037                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15038                 if (get_jenv_res == JNI_EDETACHED) {
15039                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15040                 } else {
15041                         DO_ASSERT(get_jenv_res == JNI_OK);
15042                 }
15043                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15044                 if (get_jenv_res == JNI_EDETACHED) {
15045                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15046                 }
15047                 FREE(j_calls);
15048         }
15049 }
15050 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15051         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15052         JNIEnv *env;
15053         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15054         if (get_jenv_res == JNI_EDETACHED) {
15055                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15056         } else {
15057                 DO_ASSERT(get_jenv_res == JNI_OK);
15058         }
15059         LDKOutPoint channel_id_var = channel_id;
15060         int64_t channel_id_ref = 0;
15061         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15062         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15063         LDKChannelMonitor data_var = *data;
15064         int64_t data_ref = 0;
15065         data_var = ChannelMonitor_clone(&data_var);
15066         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15067         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15068         LDKMonitorUpdateId update_id_var = update_id;
15069         int64_t update_id_ref = 0;
15070         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15071         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15072         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15073         CHECK(obj != NULL);
15074         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
15075         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15076                 (*env)->ExceptionDescribe(env);
15077                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
15078         }
15079         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15080         if (get_jenv_res == JNI_EDETACHED) {
15081                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15082         }
15083         return ret_conv;
15084 }
15085 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15086         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15087         JNIEnv *env;
15088         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15089         if (get_jenv_res == JNI_EDETACHED) {
15090                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15091         } else {
15092                 DO_ASSERT(get_jenv_res == JNI_OK);
15093         }
15094         LDKOutPoint channel_id_var = channel_id;
15095         int64_t channel_id_ref = 0;
15096         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15097         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15098         LDKChannelMonitorUpdate update_var = update;
15099         int64_t update_ref = 0;
15100         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
15101         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
15102         LDKChannelMonitor data_var = *data;
15103         int64_t data_ref = 0;
15104         data_var = ChannelMonitor_clone(&data_var);
15105         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15106         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15107         LDKMonitorUpdateId update_id_var = update_id;
15108         int64_t update_id_ref = 0;
15109         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15110         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15111         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15112         CHECK(obj != NULL);
15113         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
15114         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15115                 (*env)->ExceptionDescribe(env);
15116                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
15117         }
15118         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15119         if (get_jenv_res == JNI_EDETACHED) {
15120                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15121         }
15122         return ret_conv;
15123 }
15124 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
15125         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
15126         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15127 }
15128 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
15129         jclass c = (*env)->GetObjectClass(env, o);
15130         CHECK(c != NULL);
15131         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
15132         atomic_init(&calls->refcnt, 1);
15133         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15134         calls->o = (*env)->NewWeakGlobalRef(env, o);
15135         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15136         CHECK(calls->persist_new_channel_meth != NULL);
15137         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15138         CHECK(calls->update_persisted_channel_meth != NULL);
15139
15140         LDKPersist ret = {
15141                 .this_arg = (void*) calls,
15142                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
15143                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
15144                 .free = LDKPersist_JCalls_free,
15145         };
15146         return ret;
15147 }
15148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
15149         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
15150         *res_ptr = LDKPersist_init(env, clz, o);
15151         return tag_ptr(res_ptr, true);
15152 }
15153 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) {
15154         void* this_arg_ptr = untag_ptr(this_arg);
15155         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15156         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15157         LDKOutPoint channel_id_conv;
15158         channel_id_conv.inner = untag_ptr(channel_id);
15159         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15160         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15161         channel_id_conv = OutPoint_clone(&channel_id_conv);
15162         LDKChannelMonitor data_conv;
15163         data_conv.inner = untag_ptr(data);
15164         data_conv.is_owned = ptr_is_owned(data);
15165         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15166         data_conv.is_owned = false;
15167         LDKMonitorUpdateId update_id_conv;
15168         update_id_conv.inner = untag_ptr(update_id);
15169         update_id_conv.is_owned = ptr_is_owned(update_id);
15170         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15171         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15172         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));
15173         return ret_conv;
15174 }
15175
15176 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) {
15177         void* this_arg_ptr = untag_ptr(this_arg);
15178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15179         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15180         LDKOutPoint channel_id_conv;
15181         channel_id_conv.inner = untag_ptr(channel_id);
15182         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15183         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15184         channel_id_conv = OutPoint_clone(&channel_id_conv);
15185         LDKChannelMonitorUpdate update_conv;
15186         update_conv.inner = untag_ptr(update);
15187         update_conv.is_owned = ptr_is_owned(update);
15188         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
15189         update_conv = ChannelMonitorUpdate_clone(&update_conv);
15190         LDKChannelMonitor data_conv;
15191         data_conv.inner = untag_ptr(data);
15192         data_conv.is_owned = ptr_is_owned(data);
15193         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15194         data_conv.is_owned = false;
15195         LDKMonitorUpdateId update_id_conv;
15196         update_id_conv.inner = untag_ptr(update_id);
15197         update_id_conv.is_owned = ptr_is_owned(update_id);
15198         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15199         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15200         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));
15201         return ret_conv;
15202 }
15203
15204 typedef struct LDKFutureCallback_JCalls {
15205         atomic_size_t refcnt;
15206         JavaVM *vm;
15207         jweak o;
15208         jmethodID call_meth;
15209 } LDKFutureCallback_JCalls;
15210 static void LDKFutureCallback_JCalls_free(void* this_arg) {
15211         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15212         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15213                 JNIEnv *env;
15214                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15215                 if (get_jenv_res == JNI_EDETACHED) {
15216                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15217                 } else {
15218                         DO_ASSERT(get_jenv_res == JNI_OK);
15219                 }
15220                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15221                 if (get_jenv_res == JNI_EDETACHED) {
15222                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15223                 }
15224                 FREE(j_calls);
15225         }
15226 }
15227 void call_LDKFutureCallback_jcall(const void* this_arg) {
15228         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15229         JNIEnv *env;
15230         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15231         if (get_jenv_res == JNI_EDETACHED) {
15232                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15233         } else {
15234                 DO_ASSERT(get_jenv_res == JNI_OK);
15235         }
15236         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15237         CHECK(obj != NULL);
15238         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
15239         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15240                 (*env)->ExceptionDescribe(env);
15241                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
15242         }
15243         if (get_jenv_res == JNI_EDETACHED) {
15244                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15245         }
15246 }
15247 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
15248         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
15249         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15250 }
15251 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
15252         jclass c = (*env)->GetObjectClass(env, o);
15253         CHECK(c != NULL);
15254         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
15255         atomic_init(&calls->refcnt, 1);
15256         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15257         calls->o = (*env)->NewWeakGlobalRef(env, o);
15258         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
15259         CHECK(calls->call_meth != NULL);
15260
15261         LDKFutureCallback ret = {
15262                 .this_arg = (void*) calls,
15263                 .call = call_LDKFutureCallback_jcall,
15264                 .free = LDKFutureCallback_JCalls_free,
15265         };
15266         return ret;
15267 }
15268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
15269         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
15270         *res_ptr = LDKFutureCallback_init(env, clz, o);
15271         return tag_ptr(res_ptr, true);
15272 }
15273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
15274         void* this_arg_ptr = untag_ptr(this_arg);
15275         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15276         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15277         (this_arg_conv->call)(this_arg_conv->this_arg);
15278 }
15279
15280 typedef struct LDKListen_JCalls {
15281         atomic_size_t refcnt;
15282         JavaVM *vm;
15283         jweak o;
15284         jmethodID filtered_block_connected_meth;
15285         jmethodID block_connected_meth;
15286         jmethodID block_disconnected_meth;
15287 } LDKListen_JCalls;
15288 static void LDKListen_JCalls_free(void* this_arg) {
15289         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15290         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15291                 JNIEnv *env;
15292                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15293                 if (get_jenv_res == JNI_EDETACHED) {
15294                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15295                 } else {
15296                         DO_ASSERT(get_jenv_res == JNI_OK);
15297                 }
15298                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15299                 if (get_jenv_res == JNI_EDETACHED) {
15300                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15301                 }
15302                 FREE(j_calls);
15303         }
15304 }
15305 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15306         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15307         JNIEnv *env;
15308         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15309         if (get_jenv_res == JNI_EDETACHED) {
15310                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15311         } else {
15312                 DO_ASSERT(get_jenv_res == JNI_OK);
15313         }
15314         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15315         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15316         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15317         int64_tArray txdata_arr = NULL;
15318         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15319         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15320         for (size_t c = 0; c < txdata_var.datalen; c++) {
15321                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15322                 *txdata_conv_28_conv = txdata_var.data[c];
15323                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15324         }
15325         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15326         FREE(txdata_var.data);
15327         int32_t height_conv = height;
15328         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15329         CHECK(obj != NULL);
15330         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
15331         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15332                 (*env)->ExceptionDescribe(env);
15333                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
15334         }
15335         if (get_jenv_res == JNI_EDETACHED) {
15336                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15337         }
15338 }
15339 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
15340         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15341         JNIEnv *env;
15342         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15343         if (get_jenv_res == JNI_EDETACHED) {
15344                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15345         } else {
15346                 DO_ASSERT(get_jenv_res == JNI_OK);
15347         }
15348         LDKu8slice block_var = block;
15349         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
15350         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
15351         int32_t height_conv = height;
15352         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15353         CHECK(obj != NULL);
15354         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
15355         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15356                 (*env)->ExceptionDescribe(env);
15357                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
15358         }
15359         if (get_jenv_res == JNI_EDETACHED) {
15360                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15361         }
15362 }
15363 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15364         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15365         JNIEnv *env;
15366         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15367         if (get_jenv_res == JNI_EDETACHED) {
15368                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15369         } else {
15370                 DO_ASSERT(get_jenv_res == JNI_OK);
15371         }
15372         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15373         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15374         int32_t height_conv = height;
15375         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15376         CHECK(obj != NULL);
15377         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
15378         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15379                 (*env)->ExceptionDescribe(env);
15380                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
15381         }
15382         if (get_jenv_res == JNI_EDETACHED) {
15383                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15384         }
15385 }
15386 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
15387         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
15388         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15389 }
15390 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
15391         jclass c = (*env)->GetObjectClass(env, o);
15392         CHECK(c != NULL);
15393         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
15394         atomic_init(&calls->refcnt, 1);
15395         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15396         calls->o = (*env)->NewWeakGlobalRef(env, o);
15397         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
15398         CHECK(calls->filtered_block_connected_meth != NULL);
15399         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
15400         CHECK(calls->block_connected_meth != NULL);
15401         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
15402         CHECK(calls->block_disconnected_meth != NULL);
15403
15404         LDKListen ret = {
15405                 .this_arg = (void*) calls,
15406                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
15407                 .block_connected = block_connected_LDKListen_jcall,
15408                 .block_disconnected = block_disconnected_LDKListen_jcall,
15409                 .free = LDKListen_JCalls_free,
15410         };
15411         return ret;
15412 }
15413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
15414         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
15415         *res_ptr = LDKListen_init(env, clz, o);
15416         return tag_ptr(res_ptr, true);
15417 }
15418 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) {
15419         void* this_arg_ptr = untag_ptr(this_arg);
15420         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15421         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15422         uint8_t header_arr[80];
15423         CHECK((*env)->GetArrayLength(env, header) == 80);
15424         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15425         uint8_t (*header_ref)[80] = &header_arr;
15426         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15427         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15428         if (txdata_constr.datalen > 0)
15429                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15430         else
15431                 txdata_constr.data = NULL;
15432         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15433         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15434                 int64_t txdata_conv_28 = txdata_vals[c];
15435                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15436                 CHECK_ACCESS(txdata_conv_28_ptr);
15437                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15438                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15439                 txdata_constr.data[c] = txdata_conv_28_conv;
15440         }
15441         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15442         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15443 }
15444
15445 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) {
15446         void* this_arg_ptr = untag_ptr(this_arg);
15447         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15448         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15449         LDKu8slice block_ref;
15450         block_ref.datalen = (*env)->GetArrayLength(env, block);
15451         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
15452         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
15453         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
15454 }
15455
15456 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) {
15457         void* this_arg_ptr = untag_ptr(this_arg);
15458         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15459         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15460         uint8_t header_arr[80];
15461         CHECK((*env)->GetArrayLength(env, header) == 80);
15462         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15463         uint8_t (*header_ref)[80] = &header_arr;
15464         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
15465 }
15466
15467 typedef struct LDKConfirm_JCalls {
15468         atomic_size_t refcnt;
15469         JavaVM *vm;
15470         jweak o;
15471         jmethodID transactions_confirmed_meth;
15472         jmethodID transaction_unconfirmed_meth;
15473         jmethodID best_block_updated_meth;
15474         jmethodID get_relevant_txids_meth;
15475 } LDKConfirm_JCalls;
15476 static void LDKConfirm_JCalls_free(void* this_arg) {
15477         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15478         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15479                 JNIEnv *env;
15480                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15481                 if (get_jenv_res == JNI_EDETACHED) {
15482                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15483                 } else {
15484                         DO_ASSERT(get_jenv_res == JNI_OK);
15485                 }
15486                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15487                 if (get_jenv_res == JNI_EDETACHED) {
15488                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15489                 }
15490                 FREE(j_calls);
15491         }
15492 }
15493 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15494         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15495         JNIEnv *env;
15496         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15497         if (get_jenv_res == JNI_EDETACHED) {
15498                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15499         } else {
15500                 DO_ASSERT(get_jenv_res == JNI_OK);
15501         }
15502         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15503         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15504         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15505         int64_tArray txdata_arr = NULL;
15506         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15507         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15508         for (size_t c = 0; c < txdata_var.datalen; c++) {
15509                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15510                 *txdata_conv_28_conv = txdata_var.data[c];
15511                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15512         }
15513         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15514         FREE(txdata_var.data);
15515         int32_t height_conv = height;
15516         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15517         CHECK(obj != NULL);
15518         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
15519         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15520                 (*env)->ExceptionDescribe(env);
15521                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
15522         }
15523         if (get_jenv_res == JNI_EDETACHED) {
15524                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15525         }
15526 }
15527 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
15528         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15529         JNIEnv *env;
15530         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15531         if (get_jenv_res == JNI_EDETACHED) {
15532                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15533         } else {
15534                 DO_ASSERT(get_jenv_res == JNI_OK);
15535         }
15536         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
15537         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
15538         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15539         CHECK(obj != NULL);
15540         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
15541         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15542                 (*env)->ExceptionDescribe(env);
15543                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
15544         }
15545         if (get_jenv_res == JNI_EDETACHED) {
15546                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15547         }
15548 }
15549 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15550         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15551         JNIEnv *env;
15552         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15553         if (get_jenv_res == JNI_EDETACHED) {
15554                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15555         } else {
15556                 DO_ASSERT(get_jenv_res == JNI_OK);
15557         }
15558         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15559         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15560         int32_t height_conv = height;
15561         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15562         CHECK(obj != NULL);
15563         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
15564         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15565                 (*env)->ExceptionDescribe(env);
15566                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
15567         }
15568         if (get_jenv_res == JNI_EDETACHED) {
15569                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15570         }
15571 }
15572 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
15573         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15574         JNIEnv *env;
15575         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15576         if (get_jenv_res == JNI_EDETACHED) {
15577                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15578         } else {
15579                 DO_ASSERT(get_jenv_res == JNI_OK);
15580         }
15581         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15582         CHECK(obj != NULL);
15583         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
15584         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15585                 (*env)->ExceptionDescribe(env);
15586                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
15587         }
15588         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
15589         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15590         if (ret_constr.datalen > 0)
15591                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
15592         else
15593                 ret_constr.data = NULL;
15594         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15595         for (size_t x = 0; x < ret_constr.datalen; x++) {
15596                 int64_t ret_conv_49 = ret_vals[x];
15597                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
15598                 CHECK_ACCESS(ret_conv_49_ptr);
15599                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
15600                 FREE(untag_ptr(ret_conv_49));
15601                 ret_constr.data[x] = ret_conv_49_conv;
15602         }
15603         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15604         if (get_jenv_res == JNI_EDETACHED) {
15605                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15606         }
15607         return ret_constr;
15608 }
15609 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
15610         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
15611         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15612 }
15613 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
15614         jclass c = (*env)->GetObjectClass(env, o);
15615         CHECK(c != NULL);
15616         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
15617         atomic_init(&calls->refcnt, 1);
15618         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15619         calls->o = (*env)->NewWeakGlobalRef(env, o);
15620         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
15621         CHECK(calls->transactions_confirmed_meth != NULL);
15622         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
15623         CHECK(calls->transaction_unconfirmed_meth != NULL);
15624         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
15625         CHECK(calls->best_block_updated_meth != NULL);
15626         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
15627         CHECK(calls->get_relevant_txids_meth != NULL);
15628
15629         LDKConfirm ret = {
15630                 .this_arg = (void*) calls,
15631                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
15632                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
15633                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
15634                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
15635                 .free = LDKConfirm_JCalls_free,
15636         };
15637         return ret;
15638 }
15639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
15640         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15641         *res_ptr = LDKConfirm_init(env, clz, o);
15642         return tag_ptr(res_ptr, true);
15643 }
15644 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) {
15645         void* this_arg_ptr = untag_ptr(this_arg);
15646         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15647         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15648         uint8_t header_arr[80];
15649         CHECK((*env)->GetArrayLength(env, header) == 80);
15650         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15651         uint8_t (*header_ref)[80] = &header_arr;
15652         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15653         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15654         if (txdata_constr.datalen > 0)
15655                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15656         else
15657                 txdata_constr.data = NULL;
15658         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15659         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15660                 int64_t txdata_conv_28 = txdata_vals[c];
15661                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15662                 CHECK_ACCESS(txdata_conv_28_ptr);
15663                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15664                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15665                 txdata_constr.data[c] = txdata_conv_28_conv;
15666         }
15667         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15668         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15669 }
15670
15671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
15672         void* this_arg_ptr = untag_ptr(this_arg);
15673         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15674         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15675         uint8_t txid_arr[32];
15676         CHECK((*env)->GetArrayLength(env, txid) == 32);
15677         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15678         uint8_t (*txid_ref)[32] = &txid_arr;
15679         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
15680 }
15681
15682 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) {
15683         void* this_arg_ptr = untag_ptr(this_arg);
15684         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15685         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15686         uint8_t header_arr[80];
15687         CHECK((*env)->GetArrayLength(env, header) == 80);
15688         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15689         uint8_t (*header_ref)[80] = &header_arr;
15690         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
15691 }
15692
15693 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
15694         void* this_arg_ptr = untag_ptr(this_arg);
15695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15696         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15697         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
15698         int64_tArray ret_arr = NULL;
15699         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15700         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15701         for (size_t x = 0; x < ret_var.datalen; x++) {
15702                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
15703                 *ret_conv_49_conv = ret_var.data[x];
15704                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
15705         }
15706         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15707         FREE(ret_var.data);
15708         return ret_arr;
15709 }
15710
15711 typedef struct LDKEventHandler_JCalls {
15712         atomic_size_t refcnt;
15713         JavaVM *vm;
15714         jweak o;
15715         jmethodID handle_event_meth;
15716 } LDKEventHandler_JCalls;
15717 static void LDKEventHandler_JCalls_free(void* this_arg) {
15718         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15719         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15720                 JNIEnv *env;
15721                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15722                 if (get_jenv_res == JNI_EDETACHED) {
15723                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15724                 } else {
15725                         DO_ASSERT(get_jenv_res == JNI_OK);
15726                 }
15727                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15728                 if (get_jenv_res == JNI_EDETACHED) {
15729                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15730                 }
15731                 FREE(j_calls);
15732         }
15733 }
15734 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
15735         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15736         JNIEnv *env;
15737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15738         if (get_jenv_res == JNI_EDETACHED) {
15739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15740         } else {
15741                 DO_ASSERT(get_jenv_res == JNI_OK);
15742         }
15743         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15744         *event_copy = event;
15745         int64_t event_ref = tag_ptr(event_copy, true);
15746         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15747         CHECK(obj != NULL);
15748         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
15749         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15750                 (*env)->ExceptionDescribe(env);
15751                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
15752         }
15753         if (get_jenv_res == JNI_EDETACHED) {
15754                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15755         }
15756 }
15757 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
15758         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
15759         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15760 }
15761 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
15762         jclass c = (*env)->GetObjectClass(env, o);
15763         CHECK(c != NULL);
15764         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
15765         atomic_init(&calls->refcnt, 1);
15766         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15767         calls->o = (*env)->NewWeakGlobalRef(env, o);
15768         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
15769         CHECK(calls->handle_event_meth != NULL);
15770
15771         LDKEventHandler ret = {
15772                 .this_arg = (void*) calls,
15773                 .handle_event = handle_event_LDKEventHandler_jcall,
15774                 .free = LDKEventHandler_JCalls_free,
15775         };
15776         return ret;
15777 }
15778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
15779         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15780         *res_ptr = LDKEventHandler_init(env, clz, o);
15781         return tag_ptr(res_ptr, true);
15782 }
15783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
15784         void* this_arg_ptr = untag_ptr(this_arg);
15785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15786         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
15787         void* event_ptr = untag_ptr(event);
15788         CHECK_ACCESS(event_ptr);
15789         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
15790         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
15791         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
15792 }
15793
15794 typedef struct LDKEventsProvider_JCalls {
15795         atomic_size_t refcnt;
15796         JavaVM *vm;
15797         jweak o;
15798         jmethodID process_pending_events_meth;
15799 } LDKEventsProvider_JCalls;
15800 static void LDKEventsProvider_JCalls_free(void* this_arg) {
15801         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15802         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15803                 JNIEnv *env;
15804                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15805                 if (get_jenv_res == JNI_EDETACHED) {
15806                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15807                 } else {
15808                         DO_ASSERT(get_jenv_res == JNI_OK);
15809                 }
15810                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15811                 if (get_jenv_res == JNI_EDETACHED) {
15812                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15813                 }
15814                 FREE(j_calls);
15815         }
15816 }
15817 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
15818         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15819         JNIEnv *env;
15820         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15821         if (get_jenv_res == JNI_EDETACHED) {
15822                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15823         } else {
15824                 DO_ASSERT(get_jenv_res == JNI_OK);
15825         }
15826         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15827         *handler_ret = handler;
15828         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15829         CHECK(obj != NULL);
15830         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
15831         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15832                 (*env)->ExceptionDescribe(env);
15833                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
15834         }
15835         if (get_jenv_res == JNI_EDETACHED) {
15836                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15837         }
15838 }
15839 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
15840         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
15841         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15842 }
15843 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
15844         jclass c = (*env)->GetObjectClass(env, o);
15845         CHECK(c != NULL);
15846         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
15847         atomic_init(&calls->refcnt, 1);
15848         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15849         calls->o = (*env)->NewWeakGlobalRef(env, o);
15850         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
15851         CHECK(calls->process_pending_events_meth != NULL);
15852
15853         LDKEventsProvider ret = {
15854                 .this_arg = (void*) calls,
15855                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
15856                 .free = LDKEventsProvider_JCalls_free,
15857         };
15858         return ret;
15859 }
15860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
15861         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15862         *res_ptr = LDKEventsProvider_init(env, clz, o);
15863         return tag_ptr(res_ptr, true);
15864 }
15865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
15866         void* this_arg_ptr = untag_ptr(this_arg);
15867         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15868         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
15869         void* handler_ptr = untag_ptr(handler);
15870         CHECK_ACCESS(handler_ptr);
15871         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
15872         if (handler_conv.free == LDKEventHandler_JCalls_free) {
15873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15874                 LDKEventHandler_JCalls_cloned(&handler_conv);
15875         }
15876         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
15877 }
15878
15879 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
15880 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
15881 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
15882 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
15883 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
15884 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
15885 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
15886 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
15887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
15888         LDKFailureCode_TemporaryNodeFailure_class =
15889                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
15890         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
15891         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
15892         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
15893         LDKFailureCode_RequiredNodeFeatureMissing_class =
15894                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
15895         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
15896         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
15897         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
15898         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
15899                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
15900         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
15901         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
15902         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
15903         LDKFailureCode_InvalidOnionPayload_class =
15904                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
15905         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
15906         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
15907         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
15908 }
15909 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15910         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15911         switch(obj->tag) {
15912                 case LDKFailureCode_TemporaryNodeFailure: {
15913                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
15914                 }
15915                 case LDKFailureCode_RequiredNodeFeatureMissing: {
15916                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
15917                 }
15918                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
15919                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
15920                 }
15921                 case LDKFailureCode_InvalidOnionPayload: {
15922                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
15923                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
15924                 }
15925                 default: abort();
15926         }
15927 }
15928 typedef struct LDKMessageSendEventsProvider_JCalls {
15929         atomic_size_t refcnt;
15930         JavaVM *vm;
15931         jweak o;
15932         jmethodID get_and_clear_pending_msg_events_meth;
15933 } LDKMessageSendEventsProvider_JCalls;
15934 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
15935         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15936         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15937                 JNIEnv *env;
15938                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15939                 if (get_jenv_res == JNI_EDETACHED) {
15940                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15941                 } else {
15942                         DO_ASSERT(get_jenv_res == JNI_OK);
15943                 }
15944                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15945                 if (get_jenv_res == JNI_EDETACHED) {
15946                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15947                 }
15948                 FREE(j_calls);
15949         }
15950 }
15951 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
15952         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15953         JNIEnv *env;
15954         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15955         if (get_jenv_res == JNI_EDETACHED) {
15956                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15957         } else {
15958                 DO_ASSERT(get_jenv_res == JNI_OK);
15959         }
15960         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15961         CHECK(obj != NULL);
15962         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
15963         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15964                 (*env)->ExceptionDescribe(env);
15965                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
15966         }
15967         LDKCVec_MessageSendEventZ ret_constr;
15968         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15969         if (ret_constr.datalen > 0)
15970                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15971         else
15972                 ret_constr.data = NULL;
15973         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15974         for (size_t s = 0; s < ret_constr.datalen; s++) {
15975                 int64_t ret_conv_18 = ret_vals[s];
15976                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
15977                 CHECK_ACCESS(ret_conv_18_ptr);
15978                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
15979                 FREE(untag_ptr(ret_conv_18));
15980                 ret_constr.data[s] = ret_conv_18_conv;
15981         }
15982         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15983         if (get_jenv_res == JNI_EDETACHED) {
15984                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15985         }
15986         return ret_constr;
15987 }
15988 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
15989         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15990         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15991 }
15992 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
15993         jclass c = (*env)->GetObjectClass(env, o);
15994         CHECK(c != NULL);
15995         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
15996         atomic_init(&calls->refcnt, 1);
15997         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15998         calls->o = (*env)->NewWeakGlobalRef(env, o);
15999         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
16000         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
16001
16002         LDKMessageSendEventsProvider ret = {
16003                 .this_arg = (void*) calls,
16004                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
16005                 .free = LDKMessageSendEventsProvider_JCalls_free,
16006         };
16007         return ret;
16008 }
16009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
16010         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16011         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
16012         return tag_ptr(res_ptr, true);
16013 }
16014 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16015         void* this_arg_ptr = untag_ptr(this_arg);
16016         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16017         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
16018         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
16019         int64_tArray ret_arr = NULL;
16020         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16021         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16022         for (size_t s = 0; s < ret_var.datalen; s++) {
16023                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16024                 *ret_conv_18_copy = ret_var.data[s];
16025                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
16026                 ret_arr_ptr[s] = ret_conv_18_ref;
16027         }
16028         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16029         FREE(ret_var.data);
16030         return ret_arr;
16031 }
16032
16033 typedef struct LDKChannelMessageHandler_JCalls {
16034         atomic_size_t refcnt;
16035         JavaVM *vm;
16036         jweak o;
16037         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16038         jmethodID handle_open_channel_meth;
16039         jmethodID handle_open_channel_v2_meth;
16040         jmethodID handle_accept_channel_meth;
16041         jmethodID handle_accept_channel_v2_meth;
16042         jmethodID handle_funding_created_meth;
16043         jmethodID handle_funding_signed_meth;
16044         jmethodID handle_channel_ready_meth;
16045         jmethodID handle_shutdown_meth;
16046         jmethodID handle_closing_signed_meth;
16047         jmethodID handle_tx_add_input_meth;
16048         jmethodID handle_tx_add_output_meth;
16049         jmethodID handle_tx_remove_input_meth;
16050         jmethodID handle_tx_remove_output_meth;
16051         jmethodID handle_tx_complete_meth;
16052         jmethodID handle_tx_signatures_meth;
16053         jmethodID handle_tx_init_rbf_meth;
16054         jmethodID handle_tx_ack_rbf_meth;
16055         jmethodID handle_tx_abort_meth;
16056         jmethodID handle_update_add_htlc_meth;
16057         jmethodID handle_update_fulfill_htlc_meth;
16058         jmethodID handle_update_fail_htlc_meth;
16059         jmethodID handle_update_fail_malformed_htlc_meth;
16060         jmethodID handle_commitment_signed_meth;
16061         jmethodID handle_revoke_and_ack_meth;
16062         jmethodID handle_update_fee_meth;
16063         jmethodID handle_announcement_signatures_meth;
16064         jmethodID peer_disconnected_meth;
16065         jmethodID peer_connected_meth;
16066         jmethodID handle_channel_reestablish_meth;
16067         jmethodID handle_channel_update_meth;
16068         jmethodID handle_error_meth;
16069         jmethodID provided_node_features_meth;
16070         jmethodID provided_init_features_meth;
16071         jmethodID get_genesis_hashes_meth;
16072 } LDKChannelMessageHandler_JCalls;
16073 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
16074         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16075         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16076                 JNIEnv *env;
16077                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16078                 if (get_jenv_res == JNI_EDETACHED) {
16079                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16080                 } else {
16081                         DO_ASSERT(get_jenv_res == JNI_OK);
16082                 }
16083                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16084                 if (get_jenv_res == JNI_EDETACHED) {
16085                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16086                 }
16087                 FREE(j_calls);
16088         }
16089 }
16090 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
16091         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16092         JNIEnv *env;
16093         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16094         if (get_jenv_res == JNI_EDETACHED) {
16095                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16096         } else {
16097                 DO_ASSERT(get_jenv_res == JNI_OK);
16098         }
16099         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16100         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16101         LDKOpenChannel msg_var = *msg;
16102         int64_t msg_ref = 0;
16103         msg_var = OpenChannel_clone(&msg_var);
16104         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16105         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16106         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16107         CHECK(obj != NULL);
16108         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
16109         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16110                 (*env)->ExceptionDescribe(env);
16111                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
16112         }
16113         if (get_jenv_res == JNI_EDETACHED) {
16114                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16115         }
16116 }
16117 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
16118         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16127         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16128         LDKOpenChannelV2 msg_var = *msg;
16129         int64_t msg_ref = 0;
16130         msg_var = OpenChannelV2_clone(&msg_var);
16131         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16132         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16133         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16134         CHECK(obj != NULL);
16135         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
16136         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16137                 (*env)->ExceptionDescribe(env);
16138                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
16139         }
16140         if (get_jenv_res == JNI_EDETACHED) {
16141                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16142         }
16143 }
16144 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
16145         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16146         JNIEnv *env;
16147         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16148         if (get_jenv_res == JNI_EDETACHED) {
16149                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16150         } else {
16151                 DO_ASSERT(get_jenv_res == JNI_OK);
16152         }
16153         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16154         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16155         LDKAcceptChannel msg_var = *msg;
16156         int64_t msg_ref = 0;
16157         msg_var = AcceptChannel_clone(&msg_var);
16158         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16159         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16160         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16161         CHECK(obj != NULL);
16162         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
16163         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16164                 (*env)->ExceptionDescribe(env);
16165                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
16166         }
16167         if (get_jenv_res == JNI_EDETACHED) {
16168                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16169         }
16170 }
16171 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
16172         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16173         JNIEnv *env;
16174         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16175         if (get_jenv_res == JNI_EDETACHED) {
16176                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16177         } else {
16178                 DO_ASSERT(get_jenv_res == JNI_OK);
16179         }
16180         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16181         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16182         LDKAcceptChannelV2 msg_var = *msg;
16183         int64_t msg_ref = 0;
16184         msg_var = AcceptChannelV2_clone(&msg_var);
16185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16186         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16187         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16188         CHECK(obj != NULL);
16189         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
16190         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16191                 (*env)->ExceptionDescribe(env);
16192                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
16193         }
16194         if (get_jenv_res == JNI_EDETACHED) {
16195                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16196         }
16197 }
16198 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
16199         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16200         JNIEnv *env;
16201         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16202         if (get_jenv_res == JNI_EDETACHED) {
16203                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16204         } else {
16205                 DO_ASSERT(get_jenv_res == JNI_OK);
16206         }
16207         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16208         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16209         LDKFundingCreated msg_var = *msg;
16210         int64_t msg_ref = 0;
16211         msg_var = FundingCreated_clone(&msg_var);
16212         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16213         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16214         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16215         CHECK(obj != NULL);
16216         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
16217         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16218                 (*env)->ExceptionDescribe(env);
16219                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
16220         }
16221         if (get_jenv_res == JNI_EDETACHED) {
16222                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16223         }
16224 }
16225 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
16226         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16227         JNIEnv *env;
16228         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16229         if (get_jenv_res == JNI_EDETACHED) {
16230                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16231         } else {
16232                 DO_ASSERT(get_jenv_res == JNI_OK);
16233         }
16234         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16235         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16236         LDKFundingSigned msg_var = *msg;
16237         int64_t msg_ref = 0;
16238         msg_var = FundingSigned_clone(&msg_var);
16239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16240         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16241         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16242         CHECK(obj != NULL);
16243         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
16244         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16245                 (*env)->ExceptionDescribe(env);
16246                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
16247         }
16248         if (get_jenv_res == JNI_EDETACHED) {
16249                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16250         }
16251 }
16252 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
16253         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16254         JNIEnv *env;
16255         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16256         if (get_jenv_res == JNI_EDETACHED) {
16257                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16258         } else {
16259                 DO_ASSERT(get_jenv_res == JNI_OK);
16260         }
16261         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16262         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16263         LDKChannelReady msg_var = *msg;
16264         int64_t msg_ref = 0;
16265         msg_var = ChannelReady_clone(&msg_var);
16266         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16267         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16268         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16269         CHECK(obj != NULL);
16270         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
16271         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16272                 (*env)->ExceptionDescribe(env);
16273                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
16274         }
16275         if (get_jenv_res == JNI_EDETACHED) {
16276                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16277         }
16278 }
16279 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
16280         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16281         JNIEnv *env;
16282         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16283         if (get_jenv_res == JNI_EDETACHED) {
16284                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16285         } else {
16286                 DO_ASSERT(get_jenv_res == JNI_OK);
16287         }
16288         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16289         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16290         LDKShutdown msg_var = *msg;
16291         int64_t msg_ref = 0;
16292         msg_var = Shutdown_clone(&msg_var);
16293         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16294         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16295         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16296         CHECK(obj != NULL);
16297         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
16298         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16299                 (*env)->ExceptionDescribe(env);
16300                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
16301         }
16302         if (get_jenv_res == JNI_EDETACHED) {
16303                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16304         }
16305 }
16306 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
16307         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16308         JNIEnv *env;
16309         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16310         if (get_jenv_res == JNI_EDETACHED) {
16311                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16312         } else {
16313                 DO_ASSERT(get_jenv_res == JNI_OK);
16314         }
16315         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16316         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16317         LDKClosingSigned msg_var = *msg;
16318         int64_t msg_ref = 0;
16319         msg_var = ClosingSigned_clone(&msg_var);
16320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16321         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16322         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16323         CHECK(obj != NULL);
16324         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
16325         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16326                 (*env)->ExceptionDescribe(env);
16327                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
16328         }
16329         if (get_jenv_res == JNI_EDETACHED) {
16330                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16331         }
16332 }
16333 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
16334         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16335         JNIEnv *env;
16336         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16337         if (get_jenv_res == JNI_EDETACHED) {
16338                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16339         } else {
16340                 DO_ASSERT(get_jenv_res == JNI_OK);
16341         }
16342         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16343         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16344         LDKTxAddInput msg_var = *msg;
16345         int64_t msg_ref = 0;
16346         msg_var = TxAddInput_clone(&msg_var);
16347         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16348         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16349         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16350         CHECK(obj != NULL);
16351         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
16352         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16353                 (*env)->ExceptionDescribe(env);
16354                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
16355         }
16356         if (get_jenv_res == JNI_EDETACHED) {
16357                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16358         }
16359 }
16360 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
16361         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16362         JNIEnv *env;
16363         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16364         if (get_jenv_res == JNI_EDETACHED) {
16365                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16366         } else {
16367                 DO_ASSERT(get_jenv_res == JNI_OK);
16368         }
16369         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16370         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16371         LDKTxAddOutput msg_var = *msg;
16372         int64_t msg_ref = 0;
16373         msg_var = TxAddOutput_clone(&msg_var);
16374         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16375         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16377         CHECK(obj != NULL);
16378         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
16379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16380                 (*env)->ExceptionDescribe(env);
16381                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
16382         }
16383         if (get_jenv_res == JNI_EDETACHED) {
16384                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16385         }
16386 }
16387 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
16388         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16389         JNIEnv *env;
16390         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16391         if (get_jenv_res == JNI_EDETACHED) {
16392                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16393         } else {
16394                 DO_ASSERT(get_jenv_res == JNI_OK);
16395         }
16396         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16397         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16398         LDKTxRemoveInput msg_var = *msg;
16399         int64_t msg_ref = 0;
16400         msg_var = TxRemoveInput_clone(&msg_var);
16401         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16402         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16404         CHECK(obj != NULL);
16405         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
16406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16407                 (*env)->ExceptionDescribe(env);
16408                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
16409         }
16410         if (get_jenv_res == JNI_EDETACHED) {
16411                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16412         }
16413 }
16414 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
16415         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16416         JNIEnv *env;
16417         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16418         if (get_jenv_res == JNI_EDETACHED) {
16419                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16420         } else {
16421                 DO_ASSERT(get_jenv_res == JNI_OK);
16422         }
16423         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16424         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16425         LDKTxRemoveOutput msg_var = *msg;
16426         int64_t msg_ref = 0;
16427         msg_var = TxRemoveOutput_clone(&msg_var);
16428         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16429         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16430         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16431         CHECK(obj != NULL);
16432         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
16433         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16434                 (*env)->ExceptionDescribe(env);
16435                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
16436         }
16437         if (get_jenv_res == JNI_EDETACHED) {
16438                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16439         }
16440 }
16441 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
16442         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16443         JNIEnv *env;
16444         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16445         if (get_jenv_res == JNI_EDETACHED) {
16446                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16447         } else {
16448                 DO_ASSERT(get_jenv_res == JNI_OK);
16449         }
16450         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16451         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16452         LDKTxComplete msg_var = *msg;
16453         int64_t msg_ref = 0;
16454         msg_var = TxComplete_clone(&msg_var);
16455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16456         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16457         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16458         CHECK(obj != NULL);
16459         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
16460         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16461                 (*env)->ExceptionDescribe(env);
16462                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
16463         }
16464         if (get_jenv_res == JNI_EDETACHED) {
16465                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16466         }
16467 }
16468 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
16469         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16470         JNIEnv *env;
16471         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16472         if (get_jenv_res == JNI_EDETACHED) {
16473                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16474         } else {
16475                 DO_ASSERT(get_jenv_res == JNI_OK);
16476         }
16477         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16478         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16479         LDKTxSignatures msg_var = *msg;
16480         int64_t msg_ref = 0;
16481         msg_var = TxSignatures_clone(&msg_var);
16482         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16483         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16484         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16485         CHECK(obj != NULL);
16486         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
16487         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16488                 (*env)->ExceptionDescribe(env);
16489                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
16490         }
16491         if (get_jenv_res == JNI_EDETACHED) {
16492                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16493         }
16494 }
16495 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
16496         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16497         JNIEnv *env;
16498         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16499         if (get_jenv_res == JNI_EDETACHED) {
16500                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16501         } else {
16502                 DO_ASSERT(get_jenv_res == JNI_OK);
16503         }
16504         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16505         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16506         LDKTxInitRbf msg_var = *msg;
16507         int64_t msg_ref = 0;
16508         msg_var = TxInitRbf_clone(&msg_var);
16509         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16510         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16511         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16512         CHECK(obj != NULL);
16513         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
16514         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16515                 (*env)->ExceptionDescribe(env);
16516                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
16517         }
16518         if (get_jenv_res == JNI_EDETACHED) {
16519                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16520         }
16521 }
16522 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
16523         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16524         JNIEnv *env;
16525         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16526         if (get_jenv_res == JNI_EDETACHED) {
16527                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16528         } else {
16529                 DO_ASSERT(get_jenv_res == JNI_OK);
16530         }
16531         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16532         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16533         LDKTxAckRbf msg_var = *msg;
16534         int64_t msg_ref = 0;
16535         msg_var = TxAckRbf_clone(&msg_var);
16536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16537         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16538         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16539         CHECK(obj != NULL);
16540         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
16541         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16542                 (*env)->ExceptionDescribe(env);
16543                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
16544         }
16545         if (get_jenv_res == JNI_EDETACHED) {
16546                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16547         }
16548 }
16549 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
16550         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16551         JNIEnv *env;
16552         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16553         if (get_jenv_res == JNI_EDETACHED) {
16554                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16555         } else {
16556                 DO_ASSERT(get_jenv_res == JNI_OK);
16557         }
16558         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16559         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16560         LDKTxAbort msg_var = *msg;
16561         int64_t msg_ref = 0;
16562         msg_var = TxAbort_clone(&msg_var);
16563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16564         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16565         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16566         CHECK(obj != NULL);
16567         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
16568         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16569                 (*env)->ExceptionDescribe(env);
16570                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
16571         }
16572         if (get_jenv_res == JNI_EDETACHED) {
16573                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16574         }
16575 }
16576 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
16577         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16578         JNIEnv *env;
16579         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16580         if (get_jenv_res == JNI_EDETACHED) {
16581                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16582         } else {
16583                 DO_ASSERT(get_jenv_res == JNI_OK);
16584         }
16585         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16586         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16587         LDKUpdateAddHTLC msg_var = *msg;
16588         int64_t msg_ref = 0;
16589         msg_var = UpdateAddHTLC_clone(&msg_var);
16590         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16591         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16592         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16593         CHECK(obj != NULL);
16594         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
16595         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16596                 (*env)->ExceptionDescribe(env);
16597                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
16598         }
16599         if (get_jenv_res == JNI_EDETACHED) {
16600                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16601         }
16602 }
16603 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
16604         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
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         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16613         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16614         LDKUpdateFulfillHTLC msg_var = *msg;
16615         int64_t msg_ref = 0;
16616         msg_var = UpdateFulfillHTLC_clone(&msg_var);
16617         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16618         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16619         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16620         CHECK(obj != NULL);
16621         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
16622         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16623                 (*env)->ExceptionDescribe(env);
16624                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
16625         }
16626         if (get_jenv_res == JNI_EDETACHED) {
16627                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16628         }
16629 }
16630 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
16631         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16632         JNIEnv *env;
16633         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16634         if (get_jenv_res == JNI_EDETACHED) {
16635                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16636         } else {
16637                 DO_ASSERT(get_jenv_res == JNI_OK);
16638         }
16639         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16640         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16641         LDKUpdateFailHTLC msg_var = *msg;
16642         int64_t msg_ref = 0;
16643         msg_var = UpdateFailHTLC_clone(&msg_var);
16644         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16645         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16646         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16647         CHECK(obj != NULL);
16648         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
16649         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16650                 (*env)->ExceptionDescribe(env);
16651                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
16652         }
16653         if (get_jenv_res == JNI_EDETACHED) {
16654                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16655         }
16656 }
16657 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
16658         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16659         JNIEnv *env;
16660         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16661         if (get_jenv_res == JNI_EDETACHED) {
16662                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16663         } else {
16664                 DO_ASSERT(get_jenv_res == JNI_OK);
16665         }
16666         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16667         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16668         LDKUpdateFailMalformedHTLC msg_var = *msg;
16669         int64_t msg_ref = 0;
16670         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
16671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16672         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16673         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16674         CHECK(obj != NULL);
16675         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
16676         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16677                 (*env)->ExceptionDescribe(env);
16678                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
16679         }
16680         if (get_jenv_res == JNI_EDETACHED) {
16681                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16682         }
16683 }
16684 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
16685         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16686         JNIEnv *env;
16687         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16688         if (get_jenv_res == JNI_EDETACHED) {
16689                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16690         } else {
16691                 DO_ASSERT(get_jenv_res == JNI_OK);
16692         }
16693         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16694         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16695         LDKCommitmentSigned msg_var = *msg;
16696         int64_t msg_ref = 0;
16697         msg_var = CommitmentSigned_clone(&msg_var);
16698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16699         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16700         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16701         CHECK(obj != NULL);
16702         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
16703         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16704                 (*env)->ExceptionDescribe(env);
16705                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
16706         }
16707         if (get_jenv_res == JNI_EDETACHED) {
16708                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16709         }
16710 }
16711 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
16712         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16713         JNIEnv *env;
16714         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16715         if (get_jenv_res == JNI_EDETACHED) {
16716                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16717         } else {
16718                 DO_ASSERT(get_jenv_res == JNI_OK);
16719         }
16720         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16721         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16722         LDKRevokeAndACK msg_var = *msg;
16723         int64_t msg_ref = 0;
16724         msg_var = RevokeAndACK_clone(&msg_var);
16725         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16726         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16727         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16728         CHECK(obj != NULL);
16729         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
16730         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16731                 (*env)->ExceptionDescribe(env);
16732                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
16733         }
16734         if (get_jenv_res == JNI_EDETACHED) {
16735                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16736         }
16737 }
16738 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
16739         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16740         JNIEnv *env;
16741         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16742         if (get_jenv_res == JNI_EDETACHED) {
16743                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16744         } else {
16745                 DO_ASSERT(get_jenv_res == JNI_OK);
16746         }
16747         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16748         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16749         LDKUpdateFee msg_var = *msg;
16750         int64_t msg_ref = 0;
16751         msg_var = UpdateFee_clone(&msg_var);
16752         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16753         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16754         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16755         CHECK(obj != NULL);
16756         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
16757         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16758                 (*env)->ExceptionDescribe(env);
16759                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
16760         }
16761         if (get_jenv_res == JNI_EDETACHED) {
16762                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16763         }
16764 }
16765 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
16766         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16767         JNIEnv *env;
16768         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16769         if (get_jenv_res == JNI_EDETACHED) {
16770                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16771         } else {
16772                 DO_ASSERT(get_jenv_res == JNI_OK);
16773         }
16774         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16775         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16776         LDKAnnouncementSignatures msg_var = *msg;
16777         int64_t msg_ref = 0;
16778         msg_var = AnnouncementSignatures_clone(&msg_var);
16779         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16780         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16781         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16782         CHECK(obj != NULL);
16783         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
16784         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16785                 (*env)->ExceptionDescribe(env);
16786                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
16787         }
16788         if (get_jenv_res == JNI_EDETACHED) {
16789                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16790         }
16791 }
16792 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16793         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16794         JNIEnv *env;
16795         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16796         if (get_jenv_res == JNI_EDETACHED) {
16797                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16798         } else {
16799                 DO_ASSERT(get_jenv_res == JNI_OK);
16800         }
16801         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16802         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16803         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16804         CHECK(obj != NULL);
16805         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
16806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16807                 (*env)->ExceptionDescribe(env);
16808                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
16809         }
16810         if (get_jenv_res == JNI_EDETACHED) {
16811                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16812         }
16813 }
16814 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
16815         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16816         JNIEnv *env;
16817         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16818         if (get_jenv_res == JNI_EDETACHED) {
16819                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16820         } else {
16821                 DO_ASSERT(get_jenv_res == JNI_OK);
16822         }
16823         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16824         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16825         LDKInit msg_var = *msg;
16826         int64_t msg_ref = 0;
16827         msg_var = Init_clone(&msg_var);
16828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16829         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16830         jboolean inbound_conv = inbound;
16831         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16832         CHECK(obj != NULL);
16833         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
16834         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16835                 (*env)->ExceptionDescribe(env);
16836                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
16837         }
16838         void* ret_ptr = untag_ptr(ret);
16839         CHECK_ACCESS(ret_ptr);
16840         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16841         FREE(untag_ptr(ret));
16842         if (get_jenv_res == JNI_EDETACHED) {
16843                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16844         }
16845         return ret_conv;
16846 }
16847 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
16848         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16849         JNIEnv *env;
16850         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16851         if (get_jenv_res == JNI_EDETACHED) {
16852                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16853         } else {
16854                 DO_ASSERT(get_jenv_res == JNI_OK);
16855         }
16856         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16857         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16858         LDKChannelReestablish msg_var = *msg;
16859         int64_t msg_ref = 0;
16860         msg_var = ChannelReestablish_clone(&msg_var);
16861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16862         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16863         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16864         CHECK(obj != NULL);
16865         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
16866         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16867                 (*env)->ExceptionDescribe(env);
16868                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
16869         }
16870         if (get_jenv_res == JNI_EDETACHED) {
16871                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16872         }
16873 }
16874 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
16875         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16876         JNIEnv *env;
16877         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16878         if (get_jenv_res == JNI_EDETACHED) {
16879                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16880         } else {
16881                 DO_ASSERT(get_jenv_res == JNI_OK);
16882         }
16883         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16884         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16885         LDKChannelUpdate msg_var = *msg;
16886         int64_t msg_ref = 0;
16887         msg_var = ChannelUpdate_clone(&msg_var);
16888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16889         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16890         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16891         CHECK(obj != NULL);
16892         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
16893         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16894                 (*env)->ExceptionDescribe(env);
16895                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
16896         }
16897         if (get_jenv_res == JNI_EDETACHED) {
16898                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16899         }
16900 }
16901 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
16902         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16903         JNIEnv *env;
16904         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16905         if (get_jenv_res == JNI_EDETACHED) {
16906                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16907         } else {
16908                 DO_ASSERT(get_jenv_res == JNI_OK);
16909         }
16910         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16911         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16912         LDKErrorMessage msg_var = *msg;
16913         int64_t msg_ref = 0;
16914         msg_var = ErrorMessage_clone(&msg_var);
16915         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16916         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16917         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16918         CHECK(obj != NULL);
16919         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
16920         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16921                 (*env)->ExceptionDescribe(env);
16922                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
16923         }
16924         if (get_jenv_res == JNI_EDETACHED) {
16925                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16926         }
16927 }
16928 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
16929         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16930         JNIEnv *env;
16931         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16932         if (get_jenv_res == JNI_EDETACHED) {
16933                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16934         } else {
16935                 DO_ASSERT(get_jenv_res == JNI_OK);
16936         }
16937         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16938         CHECK(obj != NULL);
16939         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
16940         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16941                 (*env)->ExceptionDescribe(env);
16942                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
16943         }
16944         LDKNodeFeatures ret_conv;
16945         ret_conv.inner = untag_ptr(ret);
16946         ret_conv.is_owned = ptr_is_owned(ret);
16947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16948         if (get_jenv_res == JNI_EDETACHED) {
16949                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16950         }
16951         return ret_conv;
16952 }
16953 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16954         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16955         JNIEnv *env;
16956         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16957         if (get_jenv_res == JNI_EDETACHED) {
16958                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16959         } else {
16960                 DO_ASSERT(get_jenv_res == JNI_OK);
16961         }
16962         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16963         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16964         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16965         CHECK(obj != NULL);
16966         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
16967         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16968                 (*env)->ExceptionDescribe(env);
16969                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
16970         }
16971         LDKInitFeatures ret_conv;
16972         ret_conv.inner = untag_ptr(ret);
16973         ret_conv.is_owned = ptr_is_owned(ret);
16974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16975         if (get_jenv_res == JNI_EDETACHED) {
16976                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16977         }
16978         return ret_conv;
16979 }
16980 LDKCOption_CVec_ThirtyTwoBytesZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
16981         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16982         JNIEnv *env;
16983         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16984         if (get_jenv_res == JNI_EDETACHED) {
16985                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16986         } else {
16987                 DO_ASSERT(get_jenv_res == JNI_OK);
16988         }
16989         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16990         CHECK(obj != NULL);
16991         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_genesis_hashes_meth);
16992         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16993                 (*env)->ExceptionDescribe(env);
16994                 (*env)->FatalError(env, "A call to get_genesis_hashes in LDKChannelMessageHandler from rust threw an exception.");
16995         }
16996         void* ret_ptr = untag_ptr(ret);
16997         CHECK_ACCESS(ret_ptr);
16998         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
16999         FREE(untag_ptr(ret));
17000         if (get_jenv_res == JNI_EDETACHED) {
17001                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17002         }
17003         return ret_conv;
17004 }
17005 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
17006         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
17007         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17008         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
17009 }
17010 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17011         jclass c = (*env)->GetObjectClass(env, o);
17012         CHECK(c != NULL);
17013         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
17014         atomic_init(&calls->refcnt, 1);
17015         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17016         calls->o = (*env)->NewWeakGlobalRef(env, o);
17017         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
17018         CHECK(calls->handle_open_channel_meth != NULL);
17019         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
17020         CHECK(calls->handle_open_channel_v2_meth != NULL);
17021         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
17022         CHECK(calls->handle_accept_channel_meth != NULL);
17023         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
17024         CHECK(calls->handle_accept_channel_v2_meth != NULL);
17025         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
17026         CHECK(calls->handle_funding_created_meth != NULL);
17027         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
17028         CHECK(calls->handle_funding_signed_meth != NULL);
17029         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
17030         CHECK(calls->handle_channel_ready_meth != NULL);
17031         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
17032         CHECK(calls->handle_shutdown_meth != NULL);
17033         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
17034         CHECK(calls->handle_closing_signed_meth != NULL);
17035         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
17036         CHECK(calls->handle_tx_add_input_meth != NULL);
17037         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
17038         CHECK(calls->handle_tx_add_output_meth != NULL);
17039         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
17040         CHECK(calls->handle_tx_remove_input_meth != NULL);
17041         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
17042         CHECK(calls->handle_tx_remove_output_meth != NULL);
17043         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
17044         CHECK(calls->handle_tx_complete_meth != NULL);
17045         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
17046         CHECK(calls->handle_tx_signatures_meth != NULL);
17047         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
17048         CHECK(calls->handle_tx_init_rbf_meth != NULL);
17049         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
17050         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
17051         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
17052         CHECK(calls->handle_tx_abort_meth != NULL);
17053         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
17054         CHECK(calls->handle_update_add_htlc_meth != NULL);
17055         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
17056         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
17057         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
17058         CHECK(calls->handle_update_fail_htlc_meth != NULL);
17059         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
17060         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
17061         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
17062         CHECK(calls->handle_commitment_signed_meth != NULL);
17063         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
17064         CHECK(calls->handle_revoke_and_ack_meth != NULL);
17065         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
17066         CHECK(calls->handle_update_fee_meth != NULL);
17067         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
17068         CHECK(calls->handle_announcement_signatures_meth != NULL);
17069         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
17070         CHECK(calls->peer_disconnected_meth != NULL);
17071         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17072         CHECK(calls->peer_connected_meth != NULL);
17073         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
17074         CHECK(calls->handle_channel_reestablish_meth != NULL);
17075         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
17076         CHECK(calls->handle_channel_update_meth != NULL);
17077         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
17078         CHECK(calls->handle_error_meth != NULL);
17079         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17080         CHECK(calls->provided_node_features_meth != NULL);
17081         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17082         CHECK(calls->provided_init_features_meth != NULL);
17083         calls->get_genesis_hashes_meth = (*env)->GetMethodID(env, c, "get_genesis_hashes", "()J");
17084         CHECK(calls->get_genesis_hashes_meth != NULL);
17085
17086         LDKChannelMessageHandler ret = {
17087                 .this_arg = (void*) calls,
17088                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
17089                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
17090                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
17091                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
17092                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
17093                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
17094                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
17095                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
17096                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
17097                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
17098                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
17099                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
17100                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
17101                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
17102                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
17103                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
17104                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
17105                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
17106                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
17107                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
17108                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
17109                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
17110                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
17111                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
17112                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
17113                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
17114                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
17115                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
17116                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
17117                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
17118                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
17119                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
17120                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
17121                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
17122                 .free = LDKChannelMessageHandler_JCalls_free,
17123                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
17124         };
17125         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
17126         return ret;
17127 }
17128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17129         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17130         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
17131         return tag_ptr(res_ptr, true);
17132 }
17133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
17134         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
17135         return tag_ptr(&inp->MessageSendEventsProvider, false);
17136 }
17137 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) {
17138         void* this_arg_ptr = untag_ptr(this_arg);
17139         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17140         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17141         LDKPublicKey their_node_id_ref;
17142         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17143         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17144         LDKOpenChannel msg_conv;
17145         msg_conv.inner = untag_ptr(msg);
17146         msg_conv.is_owned = ptr_is_owned(msg);
17147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17148         msg_conv.is_owned = false;
17149         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17150 }
17151
17152 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) {
17153         void* this_arg_ptr = untag_ptr(this_arg);
17154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17155         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17156         LDKPublicKey their_node_id_ref;
17157         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17158         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17159         LDKOpenChannelV2 msg_conv;
17160         msg_conv.inner = untag_ptr(msg);
17161         msg_conv.is_owned = ptr_is_owned(msg);
17162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17163         msg_conv.is_owned = false;
17164         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17165 }
17166
17167 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) {
17168         void* this_arg_ptr = untag_ptr(this_arg);
17169         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17170         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17171         LDKPublicKey their_node_id_ref;
17172         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17173         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17174         LDKAcceptChannel msg_conv;
17175         msg_conv.inner = untag_ptr(msg);
17176         msg_conv.is_owned = ptr_is_owned(msg);
17177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17178         msg_conv.is_owned = false;
17179         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17180 }
17181
17182 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) {
17183         void* this_arg_ptr = untag_ptr(this_arg);
17184         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17185         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17186         LDKPublicKey their_node_id_ref;
17187         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17188         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17189         LDKAcceptChannelV2 msg_conv;
17190         msg_conv.inner = untag_ptr(msg);
17191         msg_conv.is_owned = ptr_is_owned(msg);
17192         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17193         msg_conv.is_owned = false;
17194         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17195 }
17196
17197 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) {
17198         void* this_arg_ptr = untag_ptr(this_arg);
17199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17200         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17201         LDKPublicKey their_node_id_ref;
17202         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17203         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17204         LDKFundingCreated msg_conv;
17205         msg_conv.inner = untag_ptr(msg);
17206         msg_conv.is_owned = ptr_is_owned(msg);
17207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17208         msg_conv.is_owned = false;
17209         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17210 }
17211
17212 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) {
17213         void* this_arg_ptr = untag_ptr(this_arg);
17214         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17215         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17216         LDKPublicKey their_node_id_ref;
17217         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17218         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17219         LDKFundingSigned msg_conv;
17220         msg_conv.inner = untag_ptr(msg);
17221         msg_conv.is_owned = ptr_is_owned(msg);
17222         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17223         msg_conv.is_owned = false;
17224         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17225 }
17226
17227 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) {
17228         void* this_arg_ptr = untag_ptr(this_arg);
17229         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17230         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17231         LDKPublicKey their_node_id_ref;
17232         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17233         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17234         LDKChannelReady msg_conv;
17235         msg_conv.inner = untag_ptr(msg);
17236         msg_conv.is_owned = ptr_is_owned(msg);
17237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17238         msg_conv.is_owned = false;
17239         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17240 }
17241
17242 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) {
17243         void* this_arg_ptr = untag_ptr(this_arg);
17244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17245         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17246         LDKPublicKey their_node_id_ref;
17247         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17248         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17249         LDKShutdown msg_conv;
17250         msg_conv.inner = untag_ptr(msg);
17251         msg_conv.is_owned = ptr_is_owned(msg);
17252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17253         msg_conv.is_owned = false;
17254         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17255 }
17256
17257 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) {
17258         void* this_arg_ptr = untag_ptr(this_arg);
17259         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17260         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17261         LDKPublicKey their_node_id_ref;
17262         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17263         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17264         LDKClosingSigned msg_conv;
17265         msg_conv.inner = untag_ptr(msg);
17266         msg_conv.is_owned = ptr_is_owned(msg);
17267         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17268         msg_conv.is_owned = false;
17269         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17270 }
17271
17272 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) {
17273         void* this_arg_ptr = untag_ptr(this_arg);
17274         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17275         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17276         LDKPublicKey their_node_id_ref;
17277         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17278         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17279         LDKTxAddInput msg_conv;
17280         msg_conv.inner = untag_ptr(msg);
17281         msg_conv.is_owned = ptr_is_owned(msg);
17282         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17283         msg_conv.is_owned = false;
17284         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17285 }
17286
17287 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) {
17288         void* this_arg_ptr = untag_ptr(this_arg);
17289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17290         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17291         LDKPublicKey their_node_id_ref;
17292         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17293         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17294         LDKTxAddOutput msg_conv;
17295         msg_conv.inner = untag_ptr(msg);
17296         msg_conv.is_owned = ptr_is_owned(msg);
17297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17298         msg_conv.is_owned = false;
17299         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17300 }
17301
17302 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) {
17303         void* this_arg_ptr = untag_ptr(this_arg);
17304         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17305         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17306         LDKPublicKey their_node_id_ref;
17307         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17308         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17309         LDKTxRemoveInput msg_conv;
17310         msg_conv.inner = untag_ptr(msg);
17311         msg_conv.is_owned = ptr_is_owned(msg);
17312         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17313         msg_conv.is_owned = false;
17314         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17315 }
17316
17317 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) {
17318         void* this_arg_ptr = untag_ptr(this_arg);
17319         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17320         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17321         LDKPublicKey their_node_id_ref;
17322         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17323         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17324         LDKTxRemoveOutput msg_conv;
17325         msg_conv.inner = untag_ptr(msg);
17326         msg_conv.is_owned = ptr_is_owned(msg);
17327         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17328         msg_conv.is_owned = false;
17329         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17330 }
17331
17332 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) {
17333         void* this_arg_ptr = untag_ptr(this_arg);
17334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17335         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17336         LDKPublicKey their_node_id_ref;
17337         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17338         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17339         LDKTxComplete msg_conv;
17340         msg_conv.inner = untag_ptr(msg);
17341         msg_conv.is_owned = ptr_is_owned(msg);
17342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17343         msg_conv.is_owned = false;
17344         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17345 }
17346
17347 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) {
17348         void* this_arg_ptr = untag_ptr(this_arg);
17349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17350         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17351         LDKPublicKey their_node_id_ref;
17352         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17353         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17354         LDKTxSignatures msg_conv;
17355         msg_conv.inner = untag_ptr(msg);
17356         msg_conv.is_owned = ptr_is_owned(msg);
17357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17358         msg_conv.is_owned = false;
17359         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17360 }
17361
17362 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) {
17363         void* this_arg_ptr = untag_ptr(this_arg);
17364         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17365         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17366         LDKPublicKey their_node_id_ref;
17367         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17368         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17369         LDKTxInitRbf msg_conv;
17370         msg_conv.inner = untag_ptr(msg);
17371         msg_conv.is_owned = ptr_is_owned(msg);
17372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17373         msg_conv.is_owned = false;
17374         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17375 }
17376
17377 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) {
17378         void* this_arg_ptr = untag_ptr(this_arg);
17379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17380         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17381         LDKPublicKey their_node_id_ref;
17382         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17383         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17384         LDKTxAckRbf msg_conv;
17385         msg_conv.inner = untag_ptr(msg);
17386         msg_conv.is_owned = ptr_is_owned(msg);
17387         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17388         msg_conv.is_owned = false;
17389         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17390 }
17391
17392 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) {
17393         void* this_arg_ptr = untag_ptr(this_arg);
17394         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17395         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17396         LDKPublicKey their_node_id_ref;
17397         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17398         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17399         LDKTxAbort msg_conv;
17400         msg_conv.inner = untag_ptr(msg);
17401         msg_conv.is_owned = ptr_is_owned(msg);
17402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17403         msg_conv.is_owned = false;
17404         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17405 }
17406
17407 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) {
17408         void* this_arg_ptr = untag_ptr(this_arg);
17409         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17410         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17411         LDKPublicKey their_node_id_ref;
17412         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17413         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17414         LDKUpdateAddHTLC msg_conv;
17415         msg_conv.inner = untag_ptr(msg);
17416         msg_conv.is_owned = ptr_is_owned(msg);
17417         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17418         msg_conv.is_owned = false;
17419         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17420 }
17421
17422 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) {
17423         void* this_arg_ptr = untag_ptr(this_arg);
17424         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17425         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17426         LDKPublicKey their_node_id_ref;
17427         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17428         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17429         LDKUpdateFulfillHTLC msg_conv;
17430         msg_conv.inner = untag_ptr(msg);
17431         msg_conv.is_owned = ptr_is_owned(msg);
17432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17433         msg_conv.is_owned = false;
17434         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17435 }
17436
17437 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) {
17438         void* this_arg_ptr = untag_ptr(this_arg);
17439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17440         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17441         LDKPublicKey their_node_id_ref;
17442         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17443         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17444         LDKUpdateFailHTLC msg_conv;
17445         msg_conv.inner = untag_ptr(msg);
17446         msg_conv.is_owned = ptr_is_owned(msg);
17447         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17448         msg_conv.is_owned = false;
17449         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17450 }
17451
17452 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) {
17453         void* this_arg_ptr = untag_ptr(this_arg);
17454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17455         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17456         LDKPublicKey their_node_id_ref;
17457         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17458         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17459         LDKUpdateFailMalformedHTLC msg_conv;
17460         msg_conv.inner = untag_ptr(msg);
17461         msg_conv.is_owned = ptr_is_owned(msg);
17462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17463         msg_conv.is_owned = false;
17464         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17465 }
17466
17467 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) {
17468         void* this_arg_ptr = untag_ptr(this_arg);
17469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17470         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17471         LDKPublicKey their_node_id_ref;
17472         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17473         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17474         LDKCommitmentSigned msg_conv;
17475         msg_conv.inner = untag_ptr(msg);
17476         msg_conv.is_owned = ptr_is_owned(msg);
17477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17478         msg_conv.is_owned = false;
17479         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17480 }
17481
17482 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) {
17483         void* this_arg_ptr = untag_ptr(this_arg);
17484         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17485         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17486         LDKPublicKey their_node_id_ref;
17487         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17488         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17489         LDKRevokeAndACK msg_conv;
17490         msg_conv.inner = untag_ptr(msg);
17491         msg_conv.is_owned = ptr_is_owned(msg);
17492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17493         msg_conv.is_owned = false;
17494         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17495 }
17496
17497 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) {
17498         void* this_arg_ptr = untag_ptr(this_arg);
17499         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17500         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17501         LDKPublicKey their_node_id_ref;
17502         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17503         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17504         LDKUpdateFee msg_conv;
17505         msg_conv.inner = untag_ptr(msg);
17506         msg_conv.is_owned = ptr_is_owned(msg);
17507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17508         msg_conv.is_owned = false;
17509         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17510 }
17511
17512 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) {
17513         void* this_arg_ptr = untag_ptr(this_arg);
17514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17515         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17516         LDKPublicKey their_node_id_ref;
17517         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17518         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17519         LDKAnnouncementSignatures msg_conv;
17520         msg_conv.inner = untag_ptr(msg);
17521         msg_conv.is_owned = ptr_is_owned(msg);
17522         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17523         msg_conv.is_owned = false;
17524         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17525 }
17526
17527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17528         void* this_arg_ptr = untag_ptr(this_arg);
17529         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17530         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17531         LDKPublicKey their_node_id_ref;
17532         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17533         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17534         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17535 }
17536
17537 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) {
17538         void* this_arg_ptr = untag_ptr(this_arg);
17539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17540         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17541         LDKPublicKey their_node_id_ref;
17542         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17543         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17544         LDKInit msg_conv;
17545         msg_conv.inner = untag_ptr(msg);
17546         msg_conv.is_owned = ptr_is_owned(msg);
17547         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17548         msg_conv.is_owned = false;
17549         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17550         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
17551         return tag_ptr(ret_conv, true);
17552 }
17553
17554 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) {
17555         void* this_arg_ptr = untag_ptr(this_arg);
17556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17557         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17558         LDKPublicKey their_node_id_ref;
17559         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17560         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17561         LDKChannelReestablish msg_conv;
17562         msg_conv.inner = untag_ptr(msg);
17563         msg_conv.is_owned = ptr_is_owned(msg);
17564         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17565         msg_conv.is_owned = false;
17566         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17567 }
17568
17569 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) {
17570         void* this_arg_ptr = untag_ptr(this_arg);
17571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17572         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17573         LDKPublicKey their_node_id_ref;
17574         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17575         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17576         LDKChannelUpdate msg_conv;
17577         msg_conv.inner = untag_ptr(msg);
17578         msg_conv.is_owned = ptr_is_owned(msg);
17579         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17580         msg_conv.is_owned = false;
17581         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17582 }
17583
17584 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) {
17585         void* this_arg_ptr = untag_ptr(this_arg);
17586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17587         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17588         LDKPublicKey their_node_id_ref;
17589         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17590         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17591         LDKErrorMessage msg_conv;
17592         msg_conv.inner = untag_ptr(msg);
17593         msg_conv.is_owned = ptr_is_owned(msg);
17594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17595         msg_conv.is_owned = false;
17596         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17597 }
17598
17599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17600         void* this_arg_ptr = untag_ptr(this_arg);
17601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17602         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17603         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17604         int64_t ret_ref = 0;
17605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17607         return ret_ref;
17608 }
17609
17610 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) {
17611         void* this_arg_ptr = untag_ptr(this_arg);
17612         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17613         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17614         LDKPublicKey their_node_id_ref;
17615         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17616         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17617         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17618         int64_t ret_ref = 0;
17619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17621         return ret_ref;
17622 }
17623
17624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1genesis_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
17625         void* this_arg_ptr = untag_ptr(this_arg);
17626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17627         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17628         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17629         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
17630         int64_t ret_ref = tag_ptr(ret_copy, true);
17631         return ret_ref;
17632 }
17633
17634 typedef struct LDKRoutingMessageHandler_JCalls {
17635         atomic_size_t refcnt;
17636         JavaVM *vm;
17637         jweak o;
17638         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
17639         jmethodID handle_node_announcement_meth;
17640         jmethodID handle_channel_announcement_meth;
17641         jmethodID handle_channel_update_meth;
17642         jmethodID get_next_channel_announcement_meth;
17643         jmethodID get_next_node_announcement_meth;
17644         jmethodID peer_connected_meth;
17645         jmethodID handle_reply_channel_range_meth;
17646         jmethodID handle_reply_short_channel_ids_end_meth;
17647         jmethodID handle_query_channel_range_meth;
17648         jmethodID handle_query_short_channel_ids_meth;
17649         jmethodID processing_queue_high_meth;
17650         jmethodID provided_node_features_meth;
17651         jmethodID provided_init_features_meth;
17652 } LDKRoutingMessageHandler_JCalls;
17653 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
17654         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17655         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17656                 JNIEnv *env;
17657                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17658                 if (get_jenv_res == JNI_EDETACHED) {
17659                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17660                 } else {
17661                         DO_ASSERT(get_jenv_res == JNI_OK);
17662                 }
17663                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17664                 if (get_jenv_res == JNI_EDETACHED) {
17665                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17666                 }
17667                 FREE(j_calls);
17668         }
17669 }
17670 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
17671         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17672         JNIEnv *env;
17673         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17674         if (get_jenv_res == JNI_EDETACHED) {
17675                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17676         } else {
17677                 DO_ASSERT(get_jenv_res == JNI_OK);
17678         }
17679         LDKNodeAnnouncement msg_var = *msg;
17680         int64_t msg_ref = 0;
17681         msg_var = NodeAnnouncement_clone(&msg_var);
17682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17683         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17684         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17685         CHECK(obj != NULL);
17686         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
17687         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17688                 (*env)->ExceptionDescribe(env);
17689                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17690         }
17691         void* ret_ptr = untag_ptr(ret);
17692         CHECK_ACCESS(ret_ptr);
17693         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
17694         FREE(untag_ptr(ret));
17695         if (get_jenv_res == JNI_EDETACHED) {
17696                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17697         }
17698         return ret_conv;
17699 }
17700 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
17701         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17702         JNIEnv *env;
17703         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17704         if (get_jenv_res == JNI_EDETACHED) {
17705                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17706         } else {
17707                 DO_ASSERT(get_jenv_res == JNI_OK);
17708         }
17709         LDKChannelAnnouncement msg_var = *msg;
17710         int64_t msg_ref = 0;
17711         msg_var = ChannelAnnouncement_clone(&msg_var);
17712         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17713         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17714         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17715         CHECK(obj != NULL);
17716         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
17717         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17718                 (*env)->ExceptionDescribe(env);
17719                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17720         }
17721         void* ret_ptr = untag_ptr(ret);
17722         CHECK_ACCESS(ret_ptr);
17723         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
17724         FREE(untag_ptr(ret));
17725         if (get_jenv_res == JNI_EDETACHED) {
17726                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17727         }
17728         return ret_conv;
17729 }
17730 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
17731         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17732         JNIEnv *env;
17733         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17734         if (get_jenv_res == JNI_EDETACHED) {
17735                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17736         } else {
17737                 DO_ASSERT(get_jenv_res == JNI_OK);
17738         }
17739         LDKChannelUpdate msg_var = *msg;
17740         int64_t msg_ref = 0;
17741         msg_var = ChannelUpdate_clone(&msg_var);
17742         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17743         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17744         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17745         CHECK(obj != NULL);
17746         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
17747         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17748                 (*env)->ExceptionDescribe(env);
17749                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
17750         }
17751         void* ret_ptr = untag_ptr(ret);
17752         CHECK_ACCESS(ret_ptr);
17753         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
17754         FREE(untag_ptr(ret));
17755         if (get_jenv_res == JNI_EDETACHED) {
17756                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17757         }
17758         return ret_conv;
17759 }
17760 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
17761         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17762         JNIEnv *env;
17763         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17764         if (get_jenv_res == JNI_EDETACHED) {
17765                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17766         } else {
17767                 DO_ASSERT(get_jenv_res == JNI_OK);
17768         }
17769         int64_t starting_point_conv = starting_point;
17770         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17771         CHECK(obj != NULL);
17772         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
17773         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17774                 (*env)->ExceptionDescribe(env);
17775                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17776         }
17777         void* ret_ptr = untag_ptr(ret);
17778         CHECK_ACCESS(ret_ptr);
17779         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
17780         FREE(untag_ptr(ret));
17781         if (get_jenv_res == JNI_EDETACHED) {
17782                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17783         }
17784         return ret_conv;
17785 }
17786 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
17787         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17788         JNIEnv *env;
17789         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17790         if (get_jenv_res == JNI_EDETACHED) {
17791                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17792         } else {
17793                 DO_ASSERT(get_jenv_res == JNI_OK);
17794         }
17795         LDKNodeId starting_point_var = starting_point;
17796         int64_t starting_point_ref = 0;
17797         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
17798         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
17799         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17800         CHECK(obj != NULL);
17801         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
17802         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17803                 (*env)->ExceptionDescribe(env);
17804                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17805         }
17806         LDKNodeAnnouncement ret_conv;
17807         ret_conv.inner = untag_ptr(ret);
17808         ret_conv.is_owned = ptr_is_owned(ret);
17809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17810         if (get_jenv_res == JNI_EDETACHED) {
17811                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17812         }
17813         return ret_conv;
17814 }
17815 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
17816         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17817         JNIEnv *env;
17818         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17819         if (get_jenv_res == JNI_EDETACHED) {
17820                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17821         } else {
17822                 DO_ASSERT(get_jenv_res == JNI_OK);
17823         }
17824         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17825         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17826         LDKInit init_var = *init;
17827         int64_t init_ref = 0;
17828         init_var = Init_clone(&init_var);
17829         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
17830         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
17831         jboolean inbound_conv = inbound;
17832         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17833         CHECK(obj != NULL);
17834         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
17835         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17836                 (*env)->ExceptionDescribe(env);
17837                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
17838         }
17839         void* ret_ptr = untag_ptr(ret);
17840         CHECK_ACCESS(ret_ptr);
17841         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17842         FREE(untag_ptr(ret));
17843         if (get_jenv_res == JNI_EDETACHED) {
17844                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17845         }
17846         return ret_conv;
17847 }
17848 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
17849         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17850         JNIEnv *env;
17851         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17852         if (get_jenv_res == JNI_EDETACHED) {
17853                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17854         } else {
17855                 DO_ASSERT(get_jenv_res == JNI_OK);
17856         }
17857         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17858         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17859         LDKReplyChannelRange msg_var = msg;
17860         int64_t msg_ref = 0;
17861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17862         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17863         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17864         CHECK(obj != NULL);
17865         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
17866         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17867                 (*env)->ExceptionDescribe(env);
17868                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
17869         }
17870         void* ret_ptr = untag_ptr(ret);
17871         CHECK_ACCESS(ret_ptr);
17872         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17873         FREE(untag_ptr(ret));
17874         if (get_jenv_res == JNI_EDETACHED) {
17875                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17876         }
17877         return ret_conv;
17878 }
17879 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
17880         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17881         JNIEnv *env;
17882         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17883         if (get_jenv_res == JNI_EDETACHED) {
17884                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17885         } else {
17886                 DO_ASSERT(get_jenv_res == JNI_OK);
17887         }
17888         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17889         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17890         LDKReplyShortChannelIdsEnd msg_var = msg;
17891         int64_t msg_ref = 0;
17892         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17893         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17894         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17895         CHECK(obj != NULL);
17896         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
17897         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17898                 (*env)->ExceptionDescribe(env);
17899                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
17900         }
17901         void* ret_ptr = untag_ptr(ret);
17902         CHECK_ACCESS(ret_ptr);
17903         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17904         FREE(untag_ptr(ret));
17905         if (get_jenv_res == JNI_EDETACHED) {
17906                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17907         }
17908         return ret_conv;
17909 }
17910 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
17911         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17912         JNIEnv *env;
17913         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17914         if (get_jenv_res == JNI_EDETACHED) {
17915                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17916         } else {
17917                 DO_ASSERT(get_jenv_res == JNI_OK);
17918         }
17919         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17920         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17921         LDKQueryChannelRange msg_var = msg;
17922         int64_t msg_ref = 0;
17923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17924         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17925         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17926         CHECK(obj != NULL);
17927         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
17928         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17929                 (*env)->ExceptionDescribe(env);
17930                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
17931         }
17932         void* ret_ptr = untag_ptr(ret);
17933         CHECK_ACCESS(ret_ptr);
17934         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17935         FREE(untag_ptr(ret));
17936         if (get_jenv_res == JNI_EDETACHED) {
17937                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17938         }
17939         return ret_conv;
17940 }
17941 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
17942         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17943         JNIEnv *env;
17944         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17945         if (get_jenv_res == JNI_EDETACHED) {
17946                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17947         } else {
17948                 DO_ASSERT(get_jenv_res == JNI_OK);
17949         }
17950         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17951         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17952         LDKQueryShortChannelIds msg_var = msg;
17953         int64_t msg_ref = 0;
17954         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17955         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17956         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17957         CHECK(obj != NULL);
17958         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
17959         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17960                 (*env)->ExceptionDescribe(env);
17961                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
17962         }
17963         void* ret_ptr = untag_ptr(ret);
17964         CHECK_ACCESS(ret_ptr);
17965         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17966         FREE(untag_ptr(ret));
17967         if (get_jenv_res == JNI_EDETACHED) {
17968                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17969         }
17970         return ret_conv;
17971 }
17972 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
17973         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17982         CHECK(obj != NULL);
17983         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
17984         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17985                 (*env)->ExceptionDescribe(env);
17986                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
17987         }
17988         if (get_jenv_res == JNI_EDETACHED) {
17989                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17990         }
17991         return ret;
17992 }
17993 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
17994         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17995         JNIEnv *env;
17996         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17997         if (get_jenv_res == JNI_EDETACHED) {
17998                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17999         } else {
18000                 DO_ASSERT(get_jenv_res == JNI_OK);
18001         }
18002         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18003         CHECK(obj != NULL);
18004         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18005         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18006                 (*env)->ExceptionDescribe(env);
18007                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
18008         }
18009         LDKNodeFeatures ret_conv;
18010         ret_conv.inner = untag_ptr(ret);
18011         ret_conv.is_owned = ptr_is_owned(ret);
18012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18013         if (get_jenv_res == JNI_EDETACHED) {
18014                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18015         }
18016         return ret_conv;
18017 }
18018 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18019         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18020         JNIEnv *env;
18021         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18022         if (get_jenv_res == JNI_EDETACHED) {
18023                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18024         } else {
18025                 DO_ASSERT(get_jenv_res == JNI_OK);
18026         }
18027         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18028         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18029         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18030         CHECK(obj != NULL);
18031         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18032         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18033                 (*env)->ExceptionDescribe(env);
18034                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
18035         }
18036         LDKInitFeatures ret_conv;
18037         ret_conv.inner = untag_ptr(ret);
18038         ret_conv.is_owned = ptr_is_owned(ret);
18039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18040         if (get_jenv_res == JNI_EDETACHED) {
18041                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18042         }
18043         return ret_conv;
18044 }
18045 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
18046         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
18047         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18048         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
18049 }
18050 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18051         jclass c = (*env)->GetObjectClass(env, o);
18052         CHECK(c != NULL);
18053         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
18054         atomic_init(&calls->refcnt, 1);
18055         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18056         calls->o = (*env)->NewWeakGlobalRef(env, o);
18057         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
18058         CHECK(calls->handle_node_announcement_meth != NULL);
18059         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
18060         CHECK(calls->handle_channel_announcement_meth != NULL);
18061         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
18062         CHECK(calls->handle_channel_update_meth != NULL);
18063         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
18064         CHECK(calls->get_next_channel_announcement_meth != NULL);
18065         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
18066         CHECK(calls->get_next_node_announcement_meth != NULL);
18067         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18068         CHECK(calls->peer_connected_meth != NULL);
18069         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
18070         CHECK(calls->handle_reply_channel_range_meth != NULL);
18071         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
18072         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
18073         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
18074         CHECK(calls->handle_query_channel_range_meth != NULL);
18075         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
18076         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
18077         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
18078         CHECK(calls->processing_queue_high_meth != NULL);
18079         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18080         CHECK(calls->provided_node_features_meth != NULL);
18081         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18082         CHECK(calls->provided_init_features_meth != NULL);
18083
18084         LDKRoutingMessageHandler ret = {
18085                 .this_arg = (void*) calls,
18086                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
18087                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
18088                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
18089                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
18090                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
18091                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
18092                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
18093                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
18094                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
18095                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
18096                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
18097                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
18098                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
18099                 .free = LDKRoutingMessageHandler_JCalls_free,
18100                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
18101         };
18102         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
18103         return ret;
18104 }
18105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18106         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18107         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
18108         return tag_ptr(res_ptr, true);
18109 }
18110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
18111         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
18112         return tag_ptr(&inp->MessageSendEventsProvider, false);
18113 }
18114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18115         void* this_arg_ptr = untag_ptr(this_arg);
18116         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18117         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18118         LDKNodeAnnouncement msg_conv;
18119         msg_conv.inner = untag_ptr(msg);
18120         msg_conv.is_owned = ptr_is_owned(msg);
18121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18122         msg_conv.is_owned = false;
18123         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18124         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
18125         return tag_ptr(ret_conv, true);
18126 }
18127
18128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18129         void* this_arg_ptr = untag_ptr(this_arg);
18130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18131         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18132         LDKChannelAnnouncement msg_conv;
18133         msg_conv.inner = untag_ptr(msg);
18134         msg_conv.is_owned = ptr_is_owned(msg);
18135         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18136         msg_conv.is_owned = false;
18137         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18138         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
18139         return tag_ptr(ret_conv, true);
18140 }
18141
18142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18143         void* this_arg_ptr = untag_ptr(this_arg);
18144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18145         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18146         LDKChannelUpdate msg_conv;
18147         msg_conv.inner = untag_ptr(msg);
18148         msg_conv.is_owned = ptr_is_owned(msg);
18149         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18150         msg_conv.is_owned = false;
18151         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18152         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
18153         return tag_ptr(ret_conv, true);
18154 }
18155
18156 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) {
18157         void* this_arg_ptr = untag_ptr(this_arg);
18158         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18159         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18160         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18161         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
18162         int64_t ret_ref = tag_ptr(ret_copy, true);
18163         return ret_ref;
18164 }
18165
18166 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) {
18167         void* this_arg_ptr = untag_ptr(this_arg);
18168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18169         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18170         LDKNodeId starting_point_conv;
18171         starting_point_conv.inner = untag_ptr(starting_point);
18172         starting_point_conv.is_owned = ptr_is_owned(starting_point);
18173         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
18174         starting_point_conv = NodeId_clone(&starting_point_conv);
18175         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
18176         int64_t ret_ref = 0;
18177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18179         return ret_ref;
18180 }
18181
18182 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) {
18183         void* this_arg_ptr = untag_ptr(this_arg);
18184         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18185         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18186         LDKPublicKey their_node_id_ref;
18187         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18188         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18189         LDKInit init_conv;
18190         init_conv.inner = untag_ptr(init);
18191         init_conv.is_owned = ptr_is_owned(init);
18192         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
18193         init_conv.is_owned = false;
18194         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18195         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
18196         return tag_ptr(ret_conv, true);
18197 }
18198
18199 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) {
18200         void* this_arg_ptr = untag_ptr(this_arg);
18201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18202         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18203         LDKPublicKey their_node_id_ref;
18204         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18205         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18206         LDKReplyChannelRange msg_conv;
18207         msg_conv.inner = untag_ptr(msg);
18208         msg_conv.is_owned = ptr_is_owned(msg);
18209         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18210         msg_conv = ReplyChannelRange_clone(&msg_conv);
18211         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18212         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18213         return tag_ptr(ret_conv, true);
18214 }
18215
18216 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) {
18217         void* this_arg_ptr = untag_ptr(this_arg);
18218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18219         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18220         LDKPublicKey their_node_id_ref;
18221         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18222         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18223         LDKReplyShortChannelIdsEnd msg_conv;
18224         msg_conv.inner = untag_ptr(msg);
18225         msg_conv.is_owned = ptr_is_owned(msg);
18226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18227         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
18228         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18229         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18230         return tag_ptr(ret_conv, true);
18231 }
18232
18233 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) {
18234         void* this_arg_ptr = untag_ptr(this_arg);
18235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18236         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18237         LDKPublicKey their_node_id_ref;
18238         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18239         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18240         LDKQueryChannelRange msg_conv;
18241         msg_conv.inner = untag_ptr(msg);
18242         msg_conv.is_owned = ptr_is_owned(msg);
18243         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18244         msg_conv = QueryChannelRange_clone(&msg_conv);
18245         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18246         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18247         return tag_ptr(ret_conv, true);
18248 }
18249
18250 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) {
18251         void* this_arg_ptr = untag_ptr(this_arg);
18252         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18253         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18254         LDKPublicKey their_node_id_ref;
18255         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18256         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18257         LDKQueryShortChannelIds msg_conv;
18258         msg_conv.inner = untag_ptr(msg);
18259         msg_conv.is_owned = ptr_is_owned(msg);
18260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18261         msg_conv = QueryShortChannelIds_clone(&msg_conv);
18262         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18263         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18264         return tag_ptr(ret_conv, true);
18265 }
18266
18267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
18268         void* this_arg_ptr = untag_ptr(this_arg);
18269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18270         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18271         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
18272         return ret_conv;
18273 }
18274
18275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18276         void* this_arg_ptr = untag_ptr(this_arg);
18277         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18278         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18279         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18280         int64_t ret_ref = 0;
18281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18283         return ret_ref;
18284 }
18285
18286 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) {
18287         void* this_arg_ptr = untag_ptr(this_arg);
18288         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18289         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18290         LDKPublicKey their_node_id_ref;
18291         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18292         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18293         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18294         int64_t ret_ref = 0;
18295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18297         return ret_ref;
18298 }
18299
18300 typedef struct LDKOnionMessageProvider_JCalls {
18301         atomic_size_t refcnt;
18302         JavaVM *vm;
18303         jweak o;
18304         jmethodID next_onion_message_for_peer_meth;
18305 } LDKOnionMessageProvider_JCalls;
18306 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
18307         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
18308         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18309                 JNIEnv *env;
18310                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18311                 if (get_jenv_res == JNI_EDETACHED) {
18312                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18313                 } else {
18314                         DO_ASSERT(get_jenv_res == JNI_OK);
18315                 }
18316                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18317                 if (get_jenv_res == JNI_EDETACHED) {
18318                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18319                 }
18320                 FREE(j_calls);
18321         }
18322 }
18323 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
18324         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
18325         JNIEnv *env;
18326         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18327         if (get_jenv_res == JNI_EDETACHED) {
18328                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18329         } else {
18330                 DO_ASSERT(get_jenv_res == JNI_OK);
18331         }
18332         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18333         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18334         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18335         CHECK(obj != NULL);
18336         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
18337         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18338                 (*env)->ExceptionDescribe(env);
18339                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception.");
18340         }
18341         LDKOnionMessage ret_conv;
18342         ret_conv.inner = untag_ptr(ret);
18343         ret_conv.is_owned = ptr_is_owned(ret);
18344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18345         if (get_jenv_res == JNI_EDETACHED) {
18346                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18347         }
18348         return ret_conv;
18349 }
18350 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
18351         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
18352         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18353 }
18354 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) {
18355         jclass c = (*env)->GetObjectClass(env, o);
18356         CHECK(c != NULL);
18357         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
18358         atomic_init(&calls->refcnt, 1);
18359         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18360         calls->o = (*env)->NewWeakGlobalRef(env, o);
18361         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
18362         CHECK(calls->next_onion_message_for_peer_meth != NULL);
18363
18364         LDKOnionMessageProvider ret = {
18365                 .this_arg = (void*) calls,
18366                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
18367                 .free = LDKOnionMessageProvider_JCalls_free,
18368         };
18369         return ret;
18370 }
18371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) {
18372         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
18373         *res_ptr = LDKOnionMessageProvider_init(env, clz, o);
18374         return tag_ptr(res_ptr, true);
18375 }
18376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
18377         void* this_arg_ptr = untag_ptr(this_arg);
18378         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18379         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
18380         LDKPublicKey peer_node_id_ref;
18381         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18382         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18383         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
18384         int64_t ret_ref = 0;
18385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18387         return ret_ref;
18388 }
18389
18390 typedef struct LDKOnionMessageHandler_JCalls {
18391         atomic_size_t refcnt;
18392         JavaVM *vm;
18393         jweak o;
18394         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
18395         jmethodID handle_onion_message_meth;
18396         jmethodID peer_connected_meth;
18397         jmethodID peer_disconnected_meth;
18398         jmethodID provided_node_features_meth;
18399         jmethodID provided_init_features_meth;
18400 } LDKOnionMessageHandler_JCalls;
18401 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
18402         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18403         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18404                 JNIEnv *env;
18405                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18406                 if (get_jenv_res == JNI_EDETACHED) {
18407                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18408                 } else {
18409                         DO_ASSERT(get_jenv_res == JNI_OK);
18410                 }
18411                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18412                 if (get_jenv_res == JNI_EDETACHED) {
18413                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18414                 }
18415                 FREE(j_calls);
18416         }
18417 }
18418 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
18419         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18420         JNIEnv *env;
18421         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18422         if (get_jenv_res == JNI_EDETACHED) {
18423                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18424         } else {
18425                 DO_ASSERT(get_jenv_res == JNI_OK);
18426         }
18427         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18428         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18429         LDKOnionMessage msg_var = *msg;
18430         int64_t msg_ref = 0;
18431         msg_var = OnionMessage_clone(&msg_var);
18432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18433         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18434         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18435         CHECK(obj != NULL);
18436         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
18437         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18438                 (*env)->ExceptionDescribe(env);
18439                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
18440         }
18441         if (get_jenv_res == JNI_EDETACHED) {
18442                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18443         }
18444 }
18445 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
18446         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18447         JNIEnv *env;
18448         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18449         if (get_jenv_res == JNI_EDETACHED) {
18450                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18451         } else {
18452                 DO_ASSERT(get_jenv_res == JNI_OK);
18453         }
18454         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18455         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18456         LDKInit init_var = *init;
18457         int64_t init_ref = 0;
18458         init_var = Init_clone(&init_var);
18459         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
18460         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
18461         jboolean inbound_conv = inbound;
18462         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18463         CHECK(obj != NULL);
18464         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
18465         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18466                 (*env)->ExceptionDescribe(env);
18467                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
18468         }
18469         void* ret_ptr = untag_ptr(ret);
18470         CHECK_ACCESS(ret_ptr);
18471         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18472         FREE(untag_ptr(ret));
18473         if (get_jenv_res == JNI_EDETACHED) {
18474                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18475         }
18476         return ret_conv;
18477 }
18478 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18479         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18480         JNIEnv *env;
18481         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18482         if (get_jenv_res == JNI_EDETACHED) {
18483                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18484         } else {
18485                 DO_ASSERT(get_jenv_res == JNI_OK);
18486         }
18487         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18488         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18489         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18490         CHECK(obj != NULL);
18491         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
18492         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18493                 (*env)->ExceptionDescribe(env);
18494                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
18495         }
18496         if (get_jenv_res == JNI_EDETACHED) {
18497                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18498         }
18499 }
18500 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
18501         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18502         JNIEnv *env;
18503         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18504         if (get_jenv_res == JNI_EDETACHED) {
18505                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18506         } else {
18507                 DO_ASSERT(get_jenv_res == JNI_OK);
18508         }
18509         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18510         CHECK(obj != NULL);
18511         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18512         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18513                 (*env)->ExceptionDescribe(env);
18514                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
18515         }
18516         LDKNodeFeatures ret_conv;
18517         ret_conv.inner = untag_ptr(ret);
18518         ret_conv.is_owned = ptr_is_owned(ret);
18519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18520         if (get_jenv_res == JNI_EDETACHED) {
18521                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18522         }
18523         return ret_conv;
18524 }
18525 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18526         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18527         JNIEnv *env;
18528         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18529         if (get_jenv_res == JNI_EDETACHED) {
18530                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18531         } else {
18532                 DO_ASSERT(get_jenv_res == JNI_OK);
18533         }
18534         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18535         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18536         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18537         CHECK(obj != NULL);
18538         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18539         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18540                 (*env)->ExceptionDescribe(env);
18541                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
18542         }
18543         LDKInitFeatures ret_conv;
18544         ret_conv.inner = untag_ptr(ret);
18545         ret_conv.is_owned = ptr_is_owned(ret);
18546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18547         if (get_jenv_res == JNI_EDETACHED) {
18548                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18549         }
18550         return ret_conv;
18551 }
18552 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
18553         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
18554         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18555         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
18556 }
18557 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
18558         jclass c = (*env)->GetObjectClass(env, o);
18559         CHECK(c != NULL);
18560         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
18561         atomic_init(&calls->refcnt, 1);
18562         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18563         calls->o = (*env)->NewWeakGlobalRef(env, o);
18564         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
18565         CHECK(calls->handle_onion_message_meth != NULL);
18566         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18567         CHECK(calls->peer_connected_meth != NULL);
18568         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
18569         CHECK(calls->peer_disconnected_meth != NULL);
18570         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18571         CHECK(calls->provided_node_features_meth != NULL);
18572         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18573         CHECK(calls->provided_init_features_meth != NULL);
18574
18575         LDKOnionMessageHandler ret = {
18576                 .this_arg = (void*) calls,
18577                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
18578                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
18579                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
18580                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
18581                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
18582                 .free = LDKOnionMessageHandler_JCalls_free,
18583                 .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider),
18584         };
18585         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
18586         return ret;
18587 }
18588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
18589         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
18590         *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider);
18591         return tag_ptr(res_ptr, true);
18592 }
18593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) {
18594         LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg);
18595         return tag_ptr(&inp->OnionMessageProvider, false);
18596 }
18597 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) {
18598         void* this_arg_ptr = untag_ptr(this_arg);
18599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18600         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18601         LDKPublicKey peer_node_id_ref;
18602         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18603         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18604         LDKOnionMessage msg_conv;
18605         msg_conv.inner = untag_ptr(msg);
18606         msg_conv.is_owned = ptr_is_owned(msg);
18607         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18608         msg_conv.is_owned = false;
18609         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
18610 }
18611
18612 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) {
18613         void* this_arg_ptr = untag_ptr(this_arg);
18614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18615         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18616         LDKPublicKey their_node_id_ref;
18617         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18618         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18619         LDKInit init_conv;
18620         init_conv.inner = untag_ptr(init);
18621         init_conv.is_owned = ptr_is_owned(init);
18622         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
18623         init_conv.is_owned = false;
18624         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18625         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
18626         return tag_ptr(ret_conv, true);
18627 }
18628
18629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
18630         void* this_arg_ptr = untag_ptr(this_arg);
18631         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18632         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18633         LDKPublicKey their_node_id_ref;
18634         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18635         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18636         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
18637 }
18638
18639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18640         void* this_arg_ptr = untag_ptr(this_arg);
18641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18642         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18643         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18644         int64_t ret_ref = 0;
18645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18647         return ret_ref;
18648 }
18649
18650 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) {
18651         void* this_arg_ptr = untag_ptr(this_arg);
18652         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18653         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18654         LDKPublicKey their_node_id_ref;
18655         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18656         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18657         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18658         int64_t ret_ref = 0;
18659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18661         return ret_ref;
18662 }
18663
18664 typedef struct LDKCustomMessageReader_JCalls {
18665         atomic_size_t refcnt;
18666         JavaVM *vm;
18667         jweak o;
18668         jmethodID read_meth;
18669 } LDKCustomMessageReader_JCalls;
18670 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
18671         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
18672         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18673                 JNIEnv *env;
18674                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18675                 if (get_jenv_res == JNI_EDETACHED) {
18676                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18677                 } else {
18678                         DO_ASSERT(get_jenv_res == JNI_OK);
18679                 }
18680                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18681                 if (get_jenv_res == JNI_EDETACHED) {
18682                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18683                 }
18684                 FREE(j_calls);
18685         }
18686 }
18687 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
18688         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
18689         JNIEnv *env;
18690         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18691         if (get_jenv_res == JNI_EDETACHED) {
18692                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18693         } else {
18694                 DO_ASSERT(get_jenv_res == JNI_OK);
18695         }
18696         int16_t message_type_conv = message_type;
18697         LDKu8slice buffer_var = buffer;
18698         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
18699         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
18700         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18701         CHECK(obj != NULL);
18702         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
18703         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18704                 (*env)->ExceptionDescribe(env);
18705                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
18706         }
18707         void* ret_ptr = untag_ptr(ret);
18708         CHECK_ACCESS(ret_ptr);
18709         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
18710         FREE(untag_ptr(ret));
18711         if (get_jenv_res == JNI_EDETACHED) {
18712                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18713         }
18714         return ret_conv;
18715 }
18716 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
18717         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
18718         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18719 }
18720 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
18721         jclass c = (*env)->GetObjectClass(env, o);
18722         CHECK(c != NULL);
18723         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
18724         atomic_init(&calls->refcnt, 1);
18725         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18726         calls->o = (*env)->NewWeakGlobalRef(env, o);
18727         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
18728         CHECK(calls->read_meth != NULL);
18729
18730         LDKCustomMessageReader ret = {
18731                 .this_arg = (void*) calls,
18732                 .read = read_LDKCustomMessageReader_jcall,
18733                 .free = LDKCustomMessageReader_JCalls_free,
18734         };
18735         return ret;
18736 }
18737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
18738         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
18739         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
18740         return tag_ptr(res_ptr, true);
18741 }
18742 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) {
18743         void* this_arg_ptr = untag_ptr(this_arg);
18744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18745         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
18746         LDKu8slice buffer_ref;
18747         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
18748         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
18749         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18750         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
18751         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
18752         return tag_ptr(ret_conv, true);
18753 }
18754
18755 typedef struct LDKCustomMessageHandler_JCalls {
18756         atomic_size_t refcnt;
18757         JavaVM *vm;
18758         jweak o;
18759         LDKCustomMessageReader_JCalls* CustomMessageReader;
18760         jmethodID handle_custom_message_meth;
18761         jmethodID get_and_clear_pending_msg_meth;
18762         jmethodID provided_node_features_meth;
18763         jmethodID provided_init_features_meth;
18764 } LDKCustomMessageHandler_JCalls;
18765 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
18766         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18767         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18768                 JNIEnv *env;
18769                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18770                 if (get_jenv_res == JNI_EDETACHED) {
18771                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18772                 } else {
18773                         DO_ASSERT(get_jenv_res == JNI_OK);
18774                 }
18775                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18776                 if (get_jenv_res == JNI_EDETACHED) {
18777                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18778                 }
18779                 FREE(j_calls);
18780         }
18781 }
18782 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
18783         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18784         JNIEnv *env;
18785         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18786         if (get_jenv_res == JNI_EDETACHED) {
18787                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18788         } else {
18789                 DO_ASSERT(get_jenv_res == JNI_OK);
18790         }
18791         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
18792         *msg_ret = msg;
18793         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
18794         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
18795         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18796         CHECK(obj != NULL);
18797         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
18798         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18799                 (*env)->ExceptionDescribe(env);
18800                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
18801         }
18802         void* ret_ptr = untag_ptr(ret);
18803         CHECK_ACCESS(ret_ptr);
18804         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18805         FREE(untag_ptr(ret));
18806         if (get_jenv_res == JNI_EDETACHED) {
18807                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18808         }
18809         return ret_conv;
18810 }
18811 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
18812         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18813         JNIEnv *env;
18814         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18815         if (get_jenv_res == JNI_EDETACHED) {
18816                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18817         } else {
18818                 DO_ASSERT(get_jenv_res == JNI_OK);
18819         }
18820         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18821         CHECK(obj != NULL);
18822         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
18823         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18824                 (*env)->ExceptionDescribe(env);
18825                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
18826         }
18827         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
18828         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18829         if (ret_constr.datalen > 0)
18830                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18831         else
18832                 ret_constr.data = NULL;
18833         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18834         for (size_t z = 0; z < ret_constr.datalen; z++) {
18835                 int64_t ret_conv_25 = ret_vals[z];
18836                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
18837                 CHECK_ACCESS(ret_conv_25_ptr);
18838                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
18839                 FREE(untag_ptr(ret_conv_25));
18840                 ret_constr.data[z] = ret_conv_25_conv;
18841         }
18842         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18843         if (get_jenv_res == JNI_EDETACHED) {
18844                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18845         }
18846         return ret_constr;
18847 }
18848 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
18849         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18850         JNIEnv *env;
18851         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18852         if (get_jenv_res == JNI_EDETACHED) {
18853                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18854         } else {
18855                 DO_ASSERT(get_jenv_res == JNI_OK);
18856         }
18857         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18858         CHECK(obj != NULL);
18859         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18860         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18861                 (*env)->ExceptionDescribe(env);
18862                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
18863         }
18864         LDKNodeFeatures ret_conv;
18865         ret_conv.inner = untag_ptr(ret);
18866         ret_conv.is_owned = ptr_is_owned(ret);
18867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18868         if (get_jenv_res == JNI_EDETACHED) {
18869                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18870         }
18871         return ret_conv;
18872 }
18873 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18874         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18875         JNIEnv *env;
18876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18877         if (get_jenv_res == JNI_EDETACHED) {
18878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18879         } else {
18880                 DO_ASSERT(get_jenv_res == JNI_OK);
18881         }
18882         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18883         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18884         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18885         CHECK(obj != NULL);
18886         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18887         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18888                 (*env)->ExceptionDescribe(env);
18889                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
18890         }
18891         LDKInitFeatures ret_conv;
18892         ret_conv.inner = untag_ptr(ret);
18893         ret_conv.is_owned = ptr_is_owned(ret);
18894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18895         if (get_jenv_res == JNI_EDETACHED) {
18896                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18897         }
18898         return ret_conv;
18899 }
18900 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
18901         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
18902         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18903         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
18904 }
18905 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
18906         jclass c = (*env)->GetObjectClass(env, o);
18907         CHECK(c != NULL);
18908         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
18909         atomic_init(&calls->refcnt, 1);
18910         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18911         calls->o = (*env)->NewWeakGlobalRef(env, o);
18912         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
18913         CHECK(calls->handle_custom_message_meth != NULL);
18914         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
18915         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
18916         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18917         CHECK(calls->provided_node_features_meth != NULL);
18918         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18919         CHECK(calls->provided_init_features_meth != NULL);
18920
18921         LDKCustomMessageHandler ret = {
18922                 .this_arg = (void*) calls,
18923                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
18924                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
18925                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
18926                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
18927                 .free = LDKCustomMessageHandler_JCalls_free,
18928                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
18929         };
18930         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
18931         return ret;
18932 }
18933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
18934         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
18935         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
18936         return tag_ptr(res_ptr, true);
18937 }
18938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
18939         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
18940         return tag_ptr(&inp->CustomMessageReader, false);
18941 }
18942 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) {
18943         void* this_arg_ptr = untag_ptr(this_arg);
18944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18945         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18946         void* msg_ptr = untag_ptr(msg);
18947         CHECK_ACCESS(msg_ptr);
18948         LDKType msg_conv = *(LDKType*)(msg_ptr);
18949         if (msg_conv.free == LDKType_JCalls_free) {
18950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18951                 LDKType_JCalls_cloned(&msg_conv);
18952         }
18953         LDKPublicKey sender_node_id_ref;
18954         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
18955         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
18956         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18957         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
18958         return tag_ptr(ret_conv, true);
18959 }
18960
18961 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
18962         void* this_arg_ptr = untag_ptr(this_arg);
18963         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18964         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18965         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
18966         int64_tArray ret_arr = NULL;
18967         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18968         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18969         for (size_t z = 0; z < ret_var.datalen; z++) {
18970                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18971                 *ret_conv_25_conv = ret_var.data[z];
18972                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
18973         }
18974         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18975         FREE(ret_var.data);
18976         return ret_arr;
18977 }
18978
18979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18980         void* this_arg_ptr = untag_ptr(this_arg);
18981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18982         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18983         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18984         int64_t ret_ref = 0;
18985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18987         return ret_ref;
18988 }
18989
18990 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) {
18991         void* this_arg_ptr = untag_ptr(this_arg);
18992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18993         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18994         LDKPublicKey their_node_id_ref;
18995         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18996         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18997         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18998         int64_t ret_ref = 0;
18999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19001         return ret_ref;
19002 }
19003
19004 typedef struct LDKOffersMessageHandler_JCalls {
19005         atomic_size_t refcnt;
19006         JavaVM *vm;
19007         jweak o;
19008         jmethodID handle_message_meth;
19009 } LDKOffersMessageHandler_JCalls;
19010 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
19011         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19012         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19013                 JNIEnv *env;
19014                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19015                 if (get_jenv_res == JNI_EDETACHED) {
19016                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19017                 } else {
19018                         DO_ASSERT(get_jenv_res == JNI_OK);
19019                 }
19020                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19021                 if (get_jenv_res == JNI_EDETACHED) {
19022                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19023                 }
19024                 FREE(j_calls);
19025         }
19026 }
19027 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
19028         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19029         JNIEnv *env;
19030         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19031         if (get_jenv_res == JNI_EDETACHED) {
19032                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19033         } else {
19034                 DO_ASSERT(get_jenv_res == JNI_OK);
19035         }
19036         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
19037         *message_copy = message;
19038         int64_t message_ref = tag_ptr(message_copy, true);
19039         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19040         CHECK(obj != NULL);
19041         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
19042         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19043                 (*env)->ExceptionDescribe(env);
19044                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
19045         }
19046         void* ret_ptr = untag_ptr(ret);
19047         CHECK_ACCESS(ret_ptr);
19048         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
19049         FREE(untag_ptr(ret));
19050         if (get_jenv_res == JNI_EDETACHED) {
19051                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19052         }
19053         return ret_conv;
19054 }
19055 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
19056         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
19057         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19058 }
19059 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19060         jclass c = (*env)->GetObjectClass(env, o);
19061         CHECK(c != NULL);
19062         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
19063         atomic_init(&calls->refcnt, 1);
19064         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19065         calls->o = (*env)->NewWeakGlobalRef(env, o);
19066         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
19067         CHECK(calls->handle_message_meth != NULL);
19068
19069         LDKOffersMessageHandler ret = {
19070                 .this_arg = (void*) calls,
19071                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
19072                 .free = LDKOffersMessageHandler_JCalls_free,
19073         };
19074         return ret;
19075 }
19076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19077         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
19078         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
19079         return tag_ptr(res_ptr, true);
19080 }
19081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
19082         void* this_arg_ptr = untag_ptr(this_arg);
19083         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19084         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
19085         void* message_ptr = untag_ptr(message);
19086         CHECK_ACCESS(message_ptr);
19087         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
19088         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
19089         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
19090         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
19091         int64_t ret_ref = tag_ptr(ret_copy, true);
19092         return ret_ref;
19093 }
19094
19095 typedef struct LDKCustomOnionMessageHandler_JCalls {
19096         atomic_size_t refcnt;
19097         JavaVM *vm;
19098         jweak o;
19099         jmethodID handle_custom_message_meth;
19100         jmethodID read_custom_message_meth;
19101 } LDKCustomOnionMessageHandler_JCalls;
19102 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
19103         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19104         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19105                 JNIEnv *env;
19106                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19107                 if (get_jenv_res == JNI_EDETACHED) {
19108                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19109                 } else {
19110                         DO_ASSERT(get_jenv_res == JNI_OK);
19111                 }
19112                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19113                 if (get_jenv_res == JNI_EDETACHED) {
19114                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19115                 }
19116                 FREE(j_calls);
19117         }
19118 }
19119 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
19120         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19121         JNIEnv *env;
19122         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19123         if (get_jenv_res == JNI_EDETACHED) {
19124                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19125         } else {
19126                 DO_ASSERT(get_jenv_res == JNI_OK);
19127         }
19128         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
19129         *msg_ret = msg;
19130         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19131         CHECK(obj != NULL);
19132         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
19133         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19134                 (*env)->ExceptionDescribe(env);
19135                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19136         }
19137         void* ret_ptr = untag_ptr(ret);
19138         CHECK_ACCESS(ret_ptr);
19139         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
19140         FREE(untag_ptr(ret));
19141         if (get_jenv_res == JNI_EDETACHED) {
19142                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19143         }
19144         return ret_conv;
19145 }
19146 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
19147         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19148         JNIEnv *env;
19149         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19150         if (get_jenv_res == JNI_EDETACHED) {
19151                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19152         } else {
19153                 DO_ASSERT(get_jenv_res == JNI_OK);
19154         }
19155         int64_t message_type_conv = message_type;
19156         LDKu8slice buffer_var = buffer;
19157         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
19158         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
19159         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19160         CHECK(obj != NULL);
19161         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
19162         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19163                 (*env)->ExceptionDescribe(env);
19164                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19165         }
19166         void* ret_ptr = untag_ptr(ret);
19167         CHECK_ACCESS(ret_ptr);
19168         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
19169         FREE(untag_ptr(ret));
19170         if (get_jenv_res == JNI_EDETACHED) {
19171                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19172         }
19173         return ret_conv;
19174 }
19175 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
19176         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
19177         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19178 }
19179 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19180         jclass c = (*env)->GetObjectClass(env, o);
19181         CHECK(c != NULL);
19182         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
19183         atomic_init(&calls->refcnt, 1);
19184         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19185         calls->o = (*env)->NewWeakGlobalRef(env, o);
19186         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
19187         CHECK(calls->handle_custom_message_meth != NULL);
19188         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
19189         CHECK(calls->read_custom_message_meth != NULL);
19190
19191         LDKCustomOnionMessageHandler ret = {
19192                 .this_arg = (void*) calls,
19193                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
19194                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
19195                 .free = LDKCustomOnionMessageHandler_JCalls_free,
19196         };
19197         return ret;
19198 }
19199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19200         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
19201         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
19202         return tag_ptr(res_ptr, true);
19203 }
19204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19205         void* this_arg_ptr = untag_ptr(this_arg);
19206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19207         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19208         void* msg_ptr = untag_ptr(msg);
19209         CHECK_ACCESS(msg_ptr);
19210         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
19211         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
19212                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19213                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
19214         }
19215         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19216         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
19217         int64_t ret_ref = tag_ptr(ret_copy, true);
19218         return ret_ref;
19219 }
19220
19221 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) {
19222         void* this_arg_ptr = untag_ptr(this_arg);
19223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19224         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19225         LDKu8slice buffer_ref;
19226         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
19227         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
19228         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19229         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
19230         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
19231         return tag_ptr(ret_conv, true);
19232 }
19233
19234 typedef struct LDKSocketDescriptor_JCalls {
19235         atomic_size_t refcnt;
19236         JavaVM *vm;
19237         jweak o;
19238         jmethodID send_data_meth;
19239         jmethodID disconnect_socket_meth;
19240         jmethodID eq_meth;
19241         jmethodID hash_meth;
19242 } LDKSocketDescriptor_JCalls;
19243 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
19244         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19245         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19246                 JNIEnv *env;
19247                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19248                 if (get_jenv_res == JNI_EDETACHED) {
19249                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19250                 } else {
19251                         DO_ASSERT(get_jenv_res == JNI_OK);
19252                 }
19253                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19254                 if (get_jenv_res == JNI_EDETACHED) {
19255                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19256                 }
19257                 FREE(j_calls);
19258         }
19259 }
19260 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
19261         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19262         JNIEnv *env;
19263         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19264         if (get_jenv_res == JNI_EDETACHED) {
19265                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19266         } else {
19267                 DO_ASSERT(get_jenv_res == JNI_OK);
19268         }
19269         LDKu8slice data_var = data;
19270         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
19271         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
19272         jboolean resume_read_conv = resume_read;
19273         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19274         CHECK(obj != NULL);
19275         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
19276         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19277                 (*env)->ExceptionDescribe(env);
19278                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
19279         }
19280         if (get_jenv_res == JNI_EDETACHED) {
19281                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19282         }
19283         return ret;
19284 }
19285 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
19286         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19287         JNIEnv *env;
19288         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19289         if (get_jenv_res == JNI_EDETACHED) {
19290                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19291         } else {
19292                 DO_ASSERT(get_jenv_res == JNI_OK);
19293         }
19294         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19295         CHECK(obj != NULL);
19296         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
19297         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19298                 (*env)->ExceptionDescribe(env);
19299                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
19300         }
19301         if (get_jenv_res == JNI_EDETACHED) {
19302                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19303         }
19304 }
19305 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
19306         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19307         JNIEnv *env;
19308         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19309         if (get_jenv_res == JNI_EDETACHED) {
19310                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19311         } else {
19312                 DO_ASSERT(get_jenv_res == JNI_OK);
19313         }
19314         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19315         *other_arg_clone = SocketDescriptor_clone(other_arg);
19316         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19317         CHECK(obj != NULL);
19318         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
19319         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19320                 (*env)->ExceptionDescribe(env);
19321                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
19322         }
19323         if (get_jenv_res == JNI_EDETACHED) {
19324                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19325         }
19326         return ret;
19327 }
19328 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
19329         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19330         JNIEnv *env;
19331         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19332         if (get_jenv_res == JNI_EDETACHED) {
19333                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19334         } else {
19335                 DO_ASSERT(get_jenv_res == JNI_OK);
19336         }
19337         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19338         CHECK(obj != NULL);
19339         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
19340         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19341                 (*env)->ExceptionDescribe(env);
19342                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
19343         }
19344         if (get_jenv_res == JNI_EDETACHED) {
19345                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19346         }
19347         return ret;
19348 }
19349 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
19350         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
19351         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19352 }
19353 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
19354         jclass c = (*env)->GetObjectClass(env, o);
19355         CHECK(c != NULL);
19356         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
19357         atomic_init(&calls->refcnt, 1);
19358         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19359         calls->o = (*env)->NewWeakGlobalRef(env, o);
19360         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
19361         CHECK(calls->send_data_meth != NULL);
19362         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
19363         CHECK(calls->disconnect_socket_meth != NULL);
19364         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
19365         CHECK(calls->eq_meth != NULL);
19366         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
19367         CHECK(calls->hash_meth != NULL);
19368
19369         LDKSocketDescriptor ret = {
19370                 .this_arg = (void*) calls,
19371                 .send_data = send_data_LDKSocketDescriptor_jcall,
19372                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
19373                 .eq = eq_LDKSocketDescriptor_jcall,
19374                 .hash = hash_LDKSocketDescriptor_jcall,
19375                 .cloned = LDKSocketDescriptor_JCalls_cloned,
19376                 .free = LDKSocketDescriptor_JCalls_free,
19377         };
19378         return ret;
19379 }
19380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
19381         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19382         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
19383         return tag_ptr(res_ptr, true);
19384 }
19385 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) {
19386         void* this_arg_ptr = untag_ptr(this_arg);
19387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19388         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19389         LDKu8slice data_ref;
19390         data_ref.datalen = (*env)->GetArrayLength(env, data);
19391         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
19392         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
19393         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
19394         return ret_conv;
19395 }
19396
19397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
19398         void* this_arg_ptr = untag_ptr(this_arg);
19399         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19400         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19401         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
19402 }
19403
19404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
19405         void* this_arg_ptr = untag_ptr(this_arg);
19406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19407         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19408         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
19409         return ret_conv;
19410 }
19411
19412 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
19413 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
19414 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
19415 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
19416 static jclass LDKEffectiveCapacity_Total_class = NULL;
19417 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
19418 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
19419 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
19420 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
19421 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
19422 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
19423 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
19424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
19425         LDKEffectiveCapacity_ExactLiquidity_class =
19426                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
19427         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
19428         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
19429         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
19430         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
19431                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
19432         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
19433         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
19434         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
19435         LDKEffectiveCapacity_Total_class =
19436                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
19437         CHECK(LDKEffectiveCapacity_Total_class != NULL);
19438         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
19439         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
19440         LDKEffectiveCapacity_Infinite_class =
19441                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
19442         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
19443         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
19444         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
19445         LDKEffectiveCapacity_HintMaxHTLC_class =
19446                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
19447         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
19448         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
19449         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
19450         LDKEffectiveCapacity_Unknown_class =
19451                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
19452         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
19453         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
19454         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
19455 }
19456 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19457         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
19458         switch(obj->tag) {
19459                 case LDKEffectiveCapacity_ExactLiquidity: {
19460                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
19461                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
19462                 }
19463                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
19464                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
19465                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
19466                 }
19467                 case LDKEffectiveCapacity_Total: {
19468                         int64_t capacity_msat_conv = obj->total.capacity_msat;
19469                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
19470                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
19471                 }
19472                 case LDKEffectiveCapacity_Infinite: {
19473                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
19474                 }
19475                 case LDKEffectiveCapacity_HintMaxHTLC: {
19476                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
19477                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
19478                 }
19479                 case LDKEffectiveCapacity_Unknown: {
19480                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
19481                 }
19482                 default: abort();
19483         }
19484 }
19485 static jclass LDKPayee_Blinded_class = NULL;
19486 static jmethodID LDKPayee_Blinded_meth = NULL;
19487 static jclass LDKPayee_Clear_class = NULL;
19488 static jmethodID LDKPayee_Clear_meth = NULL;
19489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
19490         LDKPayee_Blinded_class =
19491                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
19492         CHECK(LDKPayee_Blinded_class != NULL);
19493         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
19494         CHECK(LDKPayee_Blinded_meth != NULL);
19495         LDKPayee_Clear_class =
19496                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
19497         CHECK(LDKPayee_Clear_class != NULL);
19498         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
19499         CHECK(LDKPayee_Clear_meth != NULL);
19500 }
19501 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19502         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
19503         switch(obj->tag) {
19504                 case LDKPayee_Blinded: {
19505                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
19506                         int64_tArray route_hints_arr = NULL;
19507                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19508                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19509                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19510                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
19511                                 *route_hints_conv_37_conv = route_hints_var.data[l];
19512                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
19513                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
19514                         }
19515                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19516                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
19517                         int64_t features_ref = 0;
19518                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19519                         features_ref = tag_ptr(features_var.inner, false);
19520                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
19521                 }
19522                 case LDKPayee_Clear: {
19523                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
19524                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
19525                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
19526                         int64_tArray route_hints_arr = NULL;
19527                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19528                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19529                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19530                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
19531                                 int64_t route_hints_conv_11_ref = 0;
19532                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
19533                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
19534                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
19535                         }
19536                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19537                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
19538                         int64_t features_ref = 0;
19539                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19540                         features_ref = tag_ptr(features_var.inner, false);
19541                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
19542                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
19543                 }
19544                 default: abort();
19545         }
19546 }
19547 typedef struct LDKScore_JCalls {
19548         atomic_size_t refcnt;
19549         JavaVM *vm;
19550         jweak o;
19551         LDKScoreLookUp_JCalls* ScoreLookUp;
19552         LDKScoreUpdate_JCalls* ScoreUpdate;
19553         jmethodID write_meth;
19554 } LDKScore_JCalls;
19555 static void LDKScore_JCalls_free(void* this_arg) {
19556         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19557         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19558                 JNIEnv *env;
19559                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19560                 if (get_jenv_res == JNI_EDETACHED) {
19561                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19562                 } else {
19563                         DO_ASSERT(get_jenv_res == JNI_OK);
19564                 }
19565                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19566                 if (get_jenv_res == JNI_EDETACHED) {
19567                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19568                 }
19569                 FREE(j_calls);
19570         }
19571 }
19572 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
19573         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19574         JNIEnv *env;
19575         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19576         if (get_jenv_res == JNI_EDETACHED) {
19577                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19578         } else {
19579                 DO_ASSERT(get_jenv_res == JNI_OK);
19580         }
19581         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19582         CHECK(obj != NULL);
19583         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
19584         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19585                 (*env)->ExceptionDescribe(env);
19586                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
19587         }
19588         LDKCVec_u8Z ret_ref;
19589         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
19590         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
19591         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
19592         if (get_jenv_res == JNI_EDETACHED) {
19593                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19594         }
19595         return ret_ref;
19596 }
19597 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
19598         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
19599         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19600         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
19601         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
19602 }
19603 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19604         jclass c = (*env)->GetObjectClass(env, o);
19605         CHECK(c != NULL);
19606         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
19607         atomic_init(&calls->refcnt, 1);
19608         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19609         calls->o = (*env)->NewWeakGlobalRef(env, o);
19610         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
19611         CHECK(calls->write_meth != NULL);
19612
19613         LDKScore ret = {
19614                 .this_arg = (void*) calls,
19615                 .write = write_LDKScore_jcall,
19616                 .free = LDKScore_JCalls_free,
19617                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
19618                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
19619         };
19620         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
19621         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
19622         return ret;
19623 }
19624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19625         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
19626         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
19627         return tag_ptr(res_ptr, true);
19628 }
19629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
19630         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19631         return tag_ptr(&inp->ScoreLookUp, false);
19632 }
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
19634         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19635         return tag_ptr(&inp->ScoreUpdate, false);
19636 }
19637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
19638         void* this_arg_ptr = untag_ptr(this_arg);
19639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19640         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
19641         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
19642         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19643         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19644         CVec_u8Z_free(ret_var);
19645         return ret_arr;
19646 }
19647
19648 static jclass LDKDestination_Node_class = NULL;
19649 static jmethodID LDKDestination_Node_meth = NULL;
19650 static jclass LDKDestination_BlindedPath_class = NULL;
19651 static jmethodID LDKDestination_BlindedPath_meth = NULL;
19652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
19653         LDKDestination_Node_class =
19654                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
19655         CHECK(LDKDestination_Node_class != NULL);
19656         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
19657         CHECK(LDKDestination_Node_meth != NULL);
19658         LDKDestination_BlindedPath_class =
19659                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
19660         CHECK(LDKDestination_BlindedPath_class != NULL);
19661         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
19662         CHECK(LDKDestination_BlindedPath_meth != NULL);
19663 }
19664 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19665         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
19666         switch(obj->tag) {
19667                 case LDKDestination_Node: {
19668                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
19669                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
19670                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
19671                 }
19672                 case LDKDestination_BlindedPath: {
19673                         LDKBlindedPath blinded_path_var = obj->blinded_path;
19674                         int64_t blinded_path_ref = 0;
19675                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
19676                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
19677                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
19678                 }
19679                 default: abort();
19680         }
19681 }
19682 typedef struct LDKMessageRouter_JCalls {
19683         atomic_size_t refcnt;
19684         JavaVM *vm;
19685         jweak o;
19686         jmethodID find_path_meth;
19687 } LDKMessageRouter_JCalls;
19688 static void LDKMessageRouter_JCalls_free(void* this_arg) {
19689         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
19690         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19691                 JNIEnv *env;
19692                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19693                 if (get_jenv_res == JNI_EDETACHED) {
19694                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19695                 } else {
19696                         DO_ASSERT(get_jenv_res == JNI_OK);
19697                 }
19698                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19699                 if (get_jenv_res == JNI_EDETACHED) {
19700                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19701                 }
19702                 FREE(j_calls);
19703         }
19704 }
19705 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
19706         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
19707         JNIEnv *env;
19708         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19709         if (get_jenv_res == JNI_EDETACHED) {
19710                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19711         } else {
19712                 DO_ASSERT(get_jenv_res == JNI_OK);
19713         }
19714         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
19715         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
19716         LDKCVec_PublicKeyZ peers_var = peers;
19717         jobjectArray peers_arr = NULL;
19718         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
19719         ;
19720         for (size_t i = 0; i < peers_var.datalen; i++) {
19721                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
19722                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
19723                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
19724         }
19725         
19726         FREE(peers_var.data);
19727         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
19728         *destination_copy = destination;
19729         int64_t destination_ref = tag_ptr(destination_copy, true);
19730         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19731         CHECK(obj != NULL);
19732         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
19733         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19734                 (*env)->ExceptionDescribe(env);
19735                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
19736         }
19737         void* ret_ptr = untag_ptr(ret);
19738         CHECK_ACCESS(ret_ptr);
19739         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
19740         FREE(untag_ptr(ret));
19741         if (get_jenv_res == JNI_EDETACHED) {
19742                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19743         }
19744         return ret_conv;
19745 }
19746 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
19747         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
19748         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19749 }
19750 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
19751         jclass c = (*env)->GetObjectClass(env, o);
19752         CHECK(c != NULL);
19753         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
19754         atomic_init(&calls->refcnt, 1);
19755         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19756         calls->o = (*env)->NewWeakGlobalRef(env, o);
19757         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
19758         CHECK(calls->find_path_meth != NULL);
19759
19760         LDKMessageRouter ret = {
19761                 .this_arg = (void*) calls,
19762                 .find_path = find_path_LDKMessageRouter_jcall,
19763                 .free = LDKMessageRouter_JCalls_free,
19764         };
19765         return ret;
19766 }
19767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
19768         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
19769         *res_ptr = LDKMessageRouter_init(env, clz, o);
19770         return tag_ptr(res_ptr, true);
19771 }
19772 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) {
19773         void* this_arg_ptr = untag_ptr(this_arg);
19774         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19775         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
19776         LDKPublicKey sender_ref;
19777         CHECK((*env)->GetArrayLength(env, sender) == 33);
19778         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
19779         LDKCVec_PublicKeyZ peers_constr;
19780         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
19781         if (peers_constr.datalen > 0)
19782                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
19783         else
19784                 peers_constr.data = NULL;
19785         for (size_t i = 0; i < peers_constr.datalen; i++) {
19786                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
19787                 LDKPublicKey peers_conv_8_ref;
19788                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
19789                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
19790                 peers_constr.data[i] = peers_conv_8_ref;
19791         }
19792         void* destination_ptr = untag_ptr(destination);
19793         CHECK_ACCESS(destination_ptr);
19794         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
19795         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
19796         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19797         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
19798         return tag_ptr(ret_conv, true);
19799 }
19800
19801 static jclass LDKOnionMessageContents_Offers_class = NULL;
19802 static jmethodID LDKOnionMessageContents_Offers_meth = NULL;
19803 static jclass LDKOnionMessageContents_Custom_class = NULL;
19804 static jmethodID LDKOnionMessageContents_Custom_meth = NULL;
19805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init (JNIEnv *env, jclass clz) {
19806         LDKOnionMessageContents_Offers_class =
19807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Offers"));
19808         CHECK(LDKOnionMessageContents_Offers_class != NULL);
19809         LDKOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Offers_class, "<init>", "(J)V");
19810         CHECK(LDKOnionMessageContents_Offers_meth != NULL);
19811         LDKOnionMessageContents_Custom_class =
19812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Custom"));
19813         CHECK(LDKOnionMessageContents_Custom_class != NULL);
19814         LDKOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Custom_class, "<init>", "(J)V");
19815         CHECK(LDKOnionMessageContents_Custom_meth != NULL);
19816 }
19817 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19818         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
19819         switch(obj->tag) {
19820                 case LDKOnionMessageContents_Offers: {
19821                         int64_t offers_ref = tag_ptr(&obj->offers, false);
19822                         return (*env)->NewObject(env, LDKOnionMessageContents_Offers_class, LDKOnionMessageContents_Offers_meth, offers_ref);
19823                 }
19824                 case LDKOnionMessageContents_Custom: {
19825                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
19826                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
19827                         return (*env)->NewObject(env, LDKOnionMessageContents_Custom_class, LDKOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
19828                 }
19829                 default: abort();
19830         }
19831 }
19832 typedef struct LDKCoinSelectionSource_JCalls {
19833         atomic_size_t refcnt;
19834         JavaVM *vm;
19835         jweak o;
19836         jmethodID select_confirmed_utxos_meth;
19837         jmethodID sign_tx_meth;
19838 } LDKCoinSelectionSource_JCalls;
19839 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
19840         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
19841         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19842                 JNIEnv *env;
19843                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19844                 if (get_jenv_res == JNI_EDETACHED) {
19845                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19846                 } else {
19847                         DO_ASSERT(get_jenv_res == JNI_OK);
19848                 }
19849                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19850                 if (get_jenv_res == JNI_EDETACHED) {
19851                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19852                 }
19853                 FREE(j_calls);
19854         }
19855 }
19856 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) {
19857         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
19858         JNIEnv *env;
19859         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19860         if (get_jenv_res == JNI_EDETACHED) {
19861                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19862         } else {
19863                 DO_ASSERT(get_jenv_res == JNI_OK);
19864         }
19865         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
19866         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
19867         LDKCVec_InputZ must_spend_var = must_spend;
19868         int64_tArray must_spend_arr = NULL;
19869         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
19870         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
19871         for (size_t h = 0; h < must_spend_var.datalen; h++) {
19872                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
19873                 int64_t must_spend_conv_7_ref = 0;
19874                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
19875                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
19876                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
19877         }
19878         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
19879         FREE(must_spend_var.data);
19880         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
19881         int64_tArray must_pay_to_arr = NULL;
19882         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
19883         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
19884         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
19885                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19886                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
19887                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
19888         }
19889         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
19890         FREE(must_pay_to_var.data);
19891         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
19892         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19893         CHECK(obj != NULL);
19894         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);
19895         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19896                 (*env)->ExceptionDescribe(env);
19897                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
19898         }
19899         void* ret_ptr = untag_ptr(ret);
19900         CHECK_ACCESS(ret_ptr);
19901         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
19902         FREE(untag_ptr(ret));
19903         if (get_jenv_res == JNI_EDETACHED) {
19904                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19905         }
19906         return ret_conv;
19907 }
19908 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
19909         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
19910         JNIEnv *env;
19911         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19912         if (get_jenv_res == JNI_EDETACHED) {
19913                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19914         } else {
19915                 DO_ASSERT(get_jenv_res == JNI_OK);
19916         }
19917         LDKTransaction tx_var = tx;
19918         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
19919         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
19920         Transaction_free(tx_var);
19921         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19922         CHECK(obj != NULL);
19923         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
19924         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19925                 (*env)->ExceptionDescribe(env);
19926                 (*env)->FatalError(env, "A call to sign_tx in LDKCoinSelectionSource from rust threw an exception.");
19927         }
19928         void* ret_ptr = untag_ptr(ret);
19929         CHECK_ACCESS(ret_ptr);
19930         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
19931         FREE(untag_ptr(ret));
19932         if (get_jenv_res == JNI_EDETACHED) {
19933                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19934         }
19935         return ret_conv;
19936 }
19937 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
19938         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
19939         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19940 }
19941 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
19942         jclass c = (*env)->GetObjectClass(env, o);
19943         CHECK(c != NULL);
19944         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
19945         atomic_init(&calls->refcnt, 1);
19946         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19947         calls->o = (*env)->NewWeakGlobalRef(env, o);
19948         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
19949         CHECK(calls->select_confirmed_utxos_meth != NULL);
19950         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
19951         CHECK(calls->sign_tx_meth != NULL);
19952
19953         LDKCoinSelectionSource ret = {
19954                 .this_arg = (void*) calls,
19955                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
19956                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
19957                 .free = LDKCoinSelectionSource_JCalls_free,
19958         };
19959         return ret;
19960 }
19961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
19962         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
19963         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
19964         return tag_ptr(res_ptr, true);
19965 }
19966 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) {
19967         void* this_arg_ptr = untag_ptr(this_arg);
19968         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19969         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
19970         LDKThirtyTwoBytes claim_id_ref;
19971         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
19972         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
19973         LDKCVec_InputZ must_spend_constr;
19974         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
19975         if (must_spend_constr.datalen > 0)
19976                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
19977         else
19978                 must_spend_constr.data = NULL;
19979         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
19980         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
19981                 int64_t must_spend_conv_7 = must_spend_vals[h];
19982                 LDKInput must_spend_conv_7_conv;
19983                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
19984                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
19985                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
19986                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
19987                 must_spend_constr.data[h] = must_spend_conv_7_conv;
19988         }
19989         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
19990         LDKCVec_TxOutZ must_pay_to_constr;
19991         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
19992         if (must_pay_to_constr.datalen > 0)
19993                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19994         else
19995                 must_pay_to_constr.data = NULL;
19996         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
19997         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
19998                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
19999                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
20000                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
20001                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
20002                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
20003                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
20004         }
20005         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
20006         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20007         *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);
20008         return tag_ptr(ret_conv, true);
20009 }
20010
20011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20012         void* this_arg_ptr = untag_ptr(this_arg);
20013         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20014         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
20015         LDKTransaction tx_ref;
20016         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20017         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20018         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20019         tx_ref.data_is_owned = true;
20020         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20021         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20022         return tag_ptr(ret_conv, true);
20023 }
20024
20025 typedef struct LDKWalletSource_JCalls {
20026         atomic_size_t refcnt;
20027         JavaVM *vm;
20028         jweak o;
20029         jmethodID list_confirmed_utxos_meth;
20030         jmethodID get_change_script_meth;
20031         jmethodID sign_tx_meth;
20032 } LDKWalletSource_JCalls;
20033 static void LDKWalletSource_JCalls_free(void* this_arg) {
20034         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20035         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20036                 JNIEnv *env;
20037                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20038                 if (get_jenv_res == JNI_EDETACHED) {
20039                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20040                 } else {
20041                         DO_ASSERT(get_jenv_res == JNI_OK);
20042                 }
20043                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20044                 if (get_jenv_res == JNI_EDETACHED) {
20045                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20046                 }
20047                 FREE(j_calls);
20048         }
20049 }
20050 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
20051         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20052         JNIEnv *env;
20053         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20054         if (get_jenv_res == JNI_EDETACHED) {
20055                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20056         } else {
20057                 DO_ASSERT(get_jenv_res == JNI_OK);
20058         }
20059         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20060         CHECK(obj != NULL);
20061         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
20062         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20063                 (*env)->ExceptionDescribe(env);
20064                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
20065         }
20066         void* ret_ptr = untag_ptr(ret);
20067         CHECK_ACCESS(ret_ptr);
20068         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
20069         FREE(untag_ptr(ret));
20070         if (get_jenv_res == JNI_EDETACHED) {
20071                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20072         }
20073         return ret_conv;
20074 }
20075 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
20076         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20077         JNIEnv *env;
20078         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20079         if (get_jenv_res == JNI_EDETACHED) {
20080                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20081         } else {
20082                 DO_ASSERT(get_jenv_res == JNI_OK);
20083         }
20084         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20085         CHECK(obj != NULL);
20086         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
20087         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20088                 (*env)->ExceptionDescribe(env);
20089                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
20090         }
20091         void* ret_ptr = untag_ptr(ret);
20092         CHECK_ACCESS(ret_ptr);
20093         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
20094         FREE(untag_ptr(ret));
20095         if (get_jenv_res == JNI_EDETACHED) {
20096                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20097         }
20098         return ret_conv;
20099 }
20100 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
20101         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20102         JNIEnv *env;
20103         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20104         if (get_jenv_res == JNI_EDETACHED) {
20105                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20106         } else {
20107                 DO_ASSERT(get_jenv_res == JNI_OK);
20108         }
20109         LDKTransaction tx_var = tx;
20110         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
20111         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
20112         Transaction_free(tx_var);
20113         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20114         CHECK(obj != NULL);
20115         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
20116         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20117                 (*env)->ExceptionDescribe(env);
20118                 (*env)->FatalError(env, "A call to sign_tx in LDKWalletSource from rust threw an exception.");
20119         }
20120         void* ret_ptr = untag_ptr(ret);
20121         CHECK_ACCESS(ret_ptr);
20122         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
20123         FREE(untag_ptr(ret));
20124         if (get_jenv_res == JNI_EDETACHED) {
20125                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20126         }
20127         return ret_conv;
20128 }
20129 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
20130         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
20131         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20132 }
20133 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
20134         jclass c = (*env)->GetObjectClass(env, o);
20135         CHECK(c != NULL);
20136         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
20137         atomic_init(&calls->refcnt, 1);
20138         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20139         calls->o = (*env)->NewWeakGlobalRef(env, o);
20140         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
20141         CHECK(calls->list_confirmed_utxos_meth != NULL);
20142         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
20143         CHECK(calls->get_change_script_meth != NULL);
20144         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
20145         CHECK(calls->sign_tx_meth != NULL);
20146
20147         LDKWalletSource ret = {
20148                 .this_arg = (void*) calls,
20149                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
20150                 .get_change_script = get_change_script_LDKWalletSource_jcall,
20151                 .sign_tx = sign_tx_LDKWalletSource_jcall,
20152                 .free = LDKWalletSource_JCalls_free,
20153         };
20154         return ret;
20155 }
20156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
20157         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
20158         *res_ptr = LDKWalletSource_init(env, clz, o);
20159         return tag_ptr(res_ptr, true);
20160 }
20161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
20162         void* this_arg_ptr = untag_ptr(this_arg);
20163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20164         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20165         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20166         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
20167         return tag_ptr(ret_conv, true);
20168 }
20169
20170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
20171         void* this_arg_ptr = untag_ptr(this_arg);
20172         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20173         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20174         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20175         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
20176         return tag_ptr(ret_conv, true);
20177 }
20178
20179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20180         void* this_arg_ptr = untag_ptr(this_arg);
20181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20182         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20183         LDKTransaction tx_ref;
20184         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20185         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20186         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20187         tx_ref.data_is_owned = true;
20188         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20189         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20190         return tag_ptr(ret_conv, true);
20191 }
20192
20193 static jclass LDKGossipSync_P2P_class = NULL;
20194 static jmethodID LDKGossipSync_P2P_meth = NULL;
20195 static jclass LDKGossipSync_Rapid_class = NULL;
20196 static jmethodID LDKGossipSync_Rapid_meth = NULL;
20197 static jclass LDKGossipSync_None_class = NULL;
20198 static jmethodID LDKGossipSync_None_meth = NULL;
20199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
20200         LDKGossipSync_P2P_class =
20201                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
20202         CHECK(LDKGossipSync_P2P_class != NULL);
20203         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
20204         CHECK(LDKGossipSync_P2P_meth != NULL);
20205         LDKGossipSync_Rapid_class =
20206                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
20207         CHECK(LDKGossipSync_Rapid_class != NULL);
20208         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
20209         CHECK(LDKGossipSync_Rapid_meth != NULL);
20210         LDKGossipSync_None_class =
20211                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
20212         CHECK(LDKGossipSync_None_class != NULL);
20213         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
20214         CHECK(LDKGossipSync_None_meth != NULL);
20215 }
20216 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20217         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
20218         switch(obj->tag) {
20219                 case LDKGossipSync_P2P: {
20220                         LDKP2PGossipSync p2p_var = obj->p2p;
20221                         int64_t p2p_ref = 0;
20222                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
20223                         p2p_ref = tag_ptr(p2p_var.inner, false);
20224                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
20225                 }
20226                 case LDKGossipSync_Rapid: {
20227                         LDKRapidGossipSync rapid_var = obj->rapid;
20228                         int64_t rapid_ref = 0;
20229                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
20230                         rapid_ref = tag_ptr(rapid_var.inner, false);
20231                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
20232                 }
20233                 case LDKGossipSync_None: {
20234                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
20235                 }
20236                 default: abort();
20237         }
20238 }
20239 static jclass LDKFallback_SegWitProgram_class = NULL;
20240 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
20241 static jclass LDKFallback_PubKeyHash_class = NULL;
20242 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
20243 static jclass LDKFallback_ScriptHash_class = NULL;
20244 static jmethodID LDKFallback_ScriptHash_meth = NULL;
20245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
20246         LDKFallback_SegWitProgram_class =
20247                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
20248         CHECK(LDKFallback_SegWitProgram_class != NULL);
20249         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
20250         CHECK(LDKFallback_SegWitProgram_meth != NULL);
20251         LDKFallback_PubKeyHash_class =
20252                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
20253         CHECK(LDKFallback_PubKeyHash_class != NULL);
20254         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
20255         CHECK(LDKFallback_PubKeyHash_meth != NULL);
20256         LDKFallback_ScriptHash_class =
20257                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
20258         CHECK(LDKFallback_ScriptHash_class != NULL);
20259         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
20260         CHECK(LDKFallback_ScriptHash_meth != NULL);
20261 }
20262 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20263         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
20264         switch(obj->tag) {
20265                 case LDKFallback_SegWitProgram: {
20266                         uint8_t version_val = obj->seg_wit_program.version._0;
20267                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
20268                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
20269                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
20270                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
20271                 }
20272                 case LDKFallback_PubKeyHash: {
20273                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
20274                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
20275                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
20276                 }
20277                 case LDKFallback_ScriptHash: {
20278                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
20279                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
20280                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
20281                 }
20282                 default: abort();
20283         }
20284 }
20285 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20286         LDKStr ret_str = _ldk_get_compiled_version();
20287         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20288         Str_free(ret_str);
20289         return ret_conv;
20290 }
20291
20292 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20293         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
20294         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20295         Str_free(ret_str);
20296         return ret_conv;
20297 }
20298
20299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
20300         LDKU128 val_ref;
20301         CHECK((*env)->GetArrayLength(env, val) == 16);
20302         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
20303         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20304         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
20305         return ret_arr;
20306 }
20307
20308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
20309         LDKSixteenBytes le_bytes_ref;
20310         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
20311         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
20312         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20313         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
20314         return ret_arr;
20315 }
20316
20317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
20318         LDKThirtyTwoBytes big_endian_bytes_ref;
20319         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
20320         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
20321         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
20322         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
20323         return tag_ptr(ret_ref, true);
20324 }
20325
20326 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
20327         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20328         *ret_copy = Bech32Error_clone(arg);
20329         int64_t ret_ref = tag_ptr(ret_copy, true);
20330         return ret_ref;
20331 }
20332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20333         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
20334         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
20335         return ret_conv;
20336 }
20337
20338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20339         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
20340         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20341         *ret_copy = Bech32Error_clone(orig_conv);
20342         int64_t ret_ref = tag_ptr(ret_copy, true);
20343         return ret_ref;
20344 }
20345
20346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
20347         if (!ptr_is_owned(o)) return;
20348         void* o_ptr = untag_ptr(o);
20349         CHECK_ACCESS(o_ptr);
20350         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
20351         FREE(untag_ptr(o));
20352         Bech32Error_free(o_conv);
20353 }
20354
20355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20356         LDKTransaction _res_ref;
20357         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20358         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
20359         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20360         _res_ref.data_is_owned = true;
20361         Transaction_free(_res_ref);
20362 }
20363
20364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20365         LDKWitness _res_ref;
20366         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20367         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
20368         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20369         _res_ref.data_is_owned = true;
20370         Witness_free(_res_ref);
20371 }
20372
20373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
20374         if (!ptr_is_owned(_res)) return;
20375         void* _res_ptr = untag_ptr(_res);
20376         CHECK_ACCESS(_res_ptr);
20377         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
20378         FREE(untag_ptr(_res));
20379         TxIn_free(_res_conv);
20380 }
20381
20382 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) {
20383         LDKWitness witness_ref;
20384         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
20385         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
20386         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
20387         witness_ref.data_is_owned = true;
20388         LDKCVec_u8Z script_sig_ref;
20389         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
20390         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
20391         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
20392         LDKThirtyTwoBytes previous_txid_ref;
20393         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
20394         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
20395         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
20396         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
20397         return tag_ptr(ret_ref, true);
20398 }
20399
20400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
20401         LDKCVec_u8Z script_pubkey_ref;
20402         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
20403         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
20404         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
20405         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20406         *ret_ref = TxOut_new(script_pubkey_ref, value);
20407         return tag_ptr(ret_ref, true);
20408 }
20409
20410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
20411         if (!ptr_is_owned(_res)) return;
20412         void* _res_ptr = untag_ptr(_res);
20413         CHECK_ACCESS(_res_ptr);
20414         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
20415         FREE(untag_ptr(_res));
20416         TxOut_free(_res_conv);
20417 }
20418
20419 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
20420         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20421         *ret_ref = TxOut_clone(arg);
20422         return tag_ptr(ret_ref, true);
20423 }
20424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20425         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
20426         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
20427         return ret_conv;
20428 }
20429
20430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20431         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
20432         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20433         *ret_ref = TxOut_clone(orig_conv);
20434         return tag_ptr(ret_ref, true);
20435 }
20436
20437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
20438         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
20439         Str_free(dummy);
20440 }
20441
20442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
20443         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20444         *ret_copy = COption_u64Z_some(o);
20445         int64_t ret_ref = tag_ptr(ret_copy, true);
20446         return ret_ref;
20447 }
20448
20449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
20450         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20451         *ret_copy = COption_u64Z_none();
20452         int64_t ret_ref = tag_ptr(ret_copy, true);
20453         return ret_ref;
20454 }
20455
20456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
20457         if (!ptr_is_owned(_res)) return;
20458         void* _res_ptr = untag_ptr(_res);
20459         CHECK_ACCESS(_res_ptr);
20460         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
20461         FREE(untag_ptr(_res));
20462         COption_u64Z_free(_res_conv);
20463 }
20464
20465 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
20466         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20467         *ret_copy = COption_u64Z_clone(arg);
20468         int64_t ret_ref = tag_ptr(ret_copy, true);
20469         return ret_ref;
20470 }
20471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20472         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
20473         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
20474         return ret_conv;
20475 }
20476
20477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20478         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
20479         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20480         *ret_copy = COption_u64Z_clone(orig_conv);
20481         int64_t ret_ref = tag_ptr(ret_copy, true);
20482         return ret_ref;
20483 }
20484
20485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20486         LDKCVec_BlindedPathZ _res_constr;
20487         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20488         if (_res_constr.datalen > 0)
20489                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20490         else
20491                 _res_constr.data = NULL;
20492         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20493         for (size_t n = 0; n < _res_constr.datalen; n++) {
20494                 int64_t _res_conv_13 = _res_vals[n];
20495                 LDKBlindedPath _res_conv_13_conv;
20496                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
20497                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
20498                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
20499                 _res_constr.data[n] = _res_conv_13_conv;
20500         }
20501         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20502         CVec_BlindedPathZ_free(_res_constr);
20503 }
20504
20505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20506         LDKRefund o_conv;
20507         o_conv.inner = untag_ptr(o);
20508         o_conv.is_owned = ptr_is_owned(o);
20509         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20510         o_conv = Refund_clone(&o_conv);
20511         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20512         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
20513         return tag_ptr(ret_conv, true);
20514 }
20515
20516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20517         LDKBolt12ParseError e_conv;
20518         e_conv.inner = untag_ptr(e);
20519         e_conv.is_owned = ptr_is_owned(e);
20520         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20521         e_conv = Bolt12ParseError_clone(&e_conv);
20522         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20523         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
20524         return tag_ptr(ret_conv, true);
20525 }
20526
20527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20528         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
20529         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
20530         return ret_conv;
20531 }
20532
20533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20534         if (!ptr_is_owned(_res)) return;
20535         void* _res_ptr = untag_ptr(_res);
20536         CHECK_ACCESS(_res_ptr);
20537         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
20538         FREE(untag_ptr(_res));
20539         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
20540 }
20541
20542 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
20543         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20544         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
20545         return tag_ptr(ret_conv, true);
20546 }
20547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20548         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
20549         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
20550         return ret_conv;
20551 }
20552
20553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20554         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
20555         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20556         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
20557         return tag_ptr(ret_conv, true);
20558 }
20559
20560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20561         void* o_ptr = untag_ptr(o);
20562         CHECK_ACCESS(o_ptr);
20563         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
20564         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
20565         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20566         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
20567         return tag_ptr(ret_conv, true);
20568 }
20569
20570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20571         void* e_ptr = untag_ptr(e);
20572         CHECK_ACCESS(e_ptr);
20573         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20574         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20575         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20576         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
20577         return tag_ptr(ret_conv, true);
20578 }
20579
20580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20581         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
20582         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
20583         return ret_conv;
20584 }
20585
20586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20587         if (!ptr_is_owned(_res)) return;
20588         void* _res_ptr = untag_ptr(_res);
20589         CHECK_ACCESS(_res_ptr);
20590         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
20591         FREE(untag_ptr(_res));
20592         CResult_RetryDecodeErrorZ_free(_res_conv);
20593 }
20594
20595 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
20596         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20597         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
20598         return tag_ptr(ret_conv, true);
20599 }
20600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20601         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
20602         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
20603         return ret_conv;
20604 }
20605
20606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20607         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
20608         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20609         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
20610         return tag_ptr(ret_conv, true);
20611 }
20612
20613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
20614         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20615         *ret_conv = CResult_NoneAPIErrorZ_ok();
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20620         void* e_ptr = untag_ptr(e);
20621         CHECK_ACCESS(e_ptr);
20622         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20623         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20624         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20625         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
20626         return tag_ptr(ret_conv, true);
20627 }
20628
20629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20630         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
20631         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
20632         return ret_conv;
20633 }
20634
20635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20636         if (!ptr_is_owned(_res)) return;
20637         void* _res_ptr = untag_ptr(_res);
20638         CHECK_ACCESS(_res_ptr);
20639         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
20640         FREE(untag_ptr(_res));
20641         CResult_NoneAPIErrorZ_free(_res_conv);
20642 }
20643
20644 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
20645         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20646         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
20647         return tag_ptr(ret_conv, true);
20648 }
20649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20650         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
20651         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
20652         return ret_conv;
20653 }
20654
20655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20656         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
20657         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20658         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
20659         return tag_ptr(ret_conv, true);
20660 }
20661
20662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20663         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
20664         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20665         if (_res_constr.datalen > 0)
20666                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
20667         else
20668                 _res_constr.data = NULL;
20669         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20670         for (size_t w = 0; w < _res_constr.datalen; w++) {
20671                 int64_t _res_conv_22 = _res_vals[w];
20672                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20673                 CHECK_ACCESS(_res_conv_22_ptr);
20674                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
20675                 FREE(untag_ptr(_res_conv_22));
20676                 _res_constr.data[w] = _res_conv_22_conv;
20677         }
20678         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20679         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
20680 }
20681
20682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20683         LDKCVec_APIErrorZ _res_constr;
20684         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20685         if (_res_constr.datalen > 0)
20686                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
20687         else
20688                 _res_constr.data = NULL;
20689         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20690         for (size_t k = 0; k < _res_constr.datalen; k++) {
20691                 int64_t _res_conv_10 = _res_vals[k];
20692                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
20693                 CHECK_ACCESS(_res_conv_10_ptr);
20694                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
20695                 FREE(untag_ptr(_res_conv_10));
20696                 _res_constr.data[k] = _res_conv_10_conv;
20697         }
20698         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20699         CVec_APIErrorZ_free(_res_constr);
20700 }
20701
20702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
20703         LDKThirtyTwoBytes o_ref;
20704         CHECK((*env)->GetArrayLength(env, o) == 32);
20705         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20706         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20707         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
20708         int64_t ret_ref = tag_ptr(ret_copy, true);
20709         return ret_ref;
20710 }
20711
20712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
20713         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20714         *ret_copy = COption_ThirtyTwoBytesZ_none();
20715         int64_t ret_ref = tag_ptr(ret_copy, true);
20716         return ret_ref;
20717 }
20718
20719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20720         if (!ptr_is_owned(_res)) return;
20721         void* _res_ptr = untag_ptr(_res);
20722         CHECK_ACCESS(_res_ptr);
20723         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
20724         FREE(untag_ptr(_res));
20725         COption_ThirtyTwoBytesZ_free(_res_conv);
20726 }
20727
20728 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
20729         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20730         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
20731         int64_t ret_ref = tag_ptr(ret_copy, true);
20732         return ret_ref;
20733 }
20734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20735         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
20736         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
20737         return ret_conv;
20738 }
20739
20740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20741         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
20742         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20743         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
20744         int64_t ret_ref = tag_ptr(ret_copy, true);
20745         return ret_ref;
20746 }
20747
20748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20749         LDKCVec_u8Z _res_ref;
20750         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20751         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
20752         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20753         CVec_u8Z_free(_res_ref);
20754 }
20755
20756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
20757         LDKCVec_u8Z o_ref;
20758         o_ref.datalen = (*env)->GetArrayLength(env, o);
20759         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20760         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20761         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20762         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
20763         int64_t ret_ref = tag_ptr(ret_copy, true);
20764         return ret_ref;
20765 }
20766
20767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
20768         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20769         *ret_copy = COption_CVec_u8ZZ_none();
20770         int64_t ret_ref = tag_ptr(ret_copy, true);
20771         return ret_ref;
20772 }
20773
20774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20775         if (!ptr_is_owned(_res)) return;
20776         void* _res_ptr = untag_ptr(_res);
20777         CHECK_ACCESS(_res_ptr);
20778         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
20779         FREE(untag_ptr(_res));
20780         COption_CVec_u8ZZ_free(_res_conv);
20781 }
20782
20783 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
20784         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20785         *ret_copy = COption_CVec_u8ZZ_clone(arg);
20786         int64_t ret_ref = tag_ptr(ret_copy, true);
20787         return ret_ref;
20788 }
20789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20790         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
20791         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
20792         return ret_conv;
20793 }
20794
20795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20796         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
20797         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20798         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
20799         int64_t ret_ref = tag_ptr(ret_copy, true);
20800         return ret_ref;
20801 }
20802
20803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20804         LDKRecipientOnionFields o_conv;
20805         o_conv.inner = untag_ptr(o);
20806         o_conv.is_owned = ptr_is_owned(o);
20807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20808         o_conv = RecipientOnionFields_clone(&o_conv);
20809         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20810         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
20811         return tag_ptr(ret_conv, true);
20812 }
20813
20814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20815         void* e_ptr = untag_ptr(e);
20816         CHECK_ACCESS(e_ptr);
20817         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20818         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20819         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20820         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
20821         return tag_ptr(ret_conv, true);
20822 }
20823
20824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20825         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
20826         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
20827         return ret_conv;
20828 }
20829
20830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20831         if (!ptr_is_owned(_res)) return;
20832         void* _res_ptr = untag_ptr(_res);
20833         CHECK_ACCESS(_res_ptr);
20834         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
20835         FREE(untag_ptr(_res));
20836         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
20837 }
20838
20839 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
20840         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20841         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
20842         return tag_ptr(ret_conv, true);
20843 }
20844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20845         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
20846         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
20847         return ret_conv;
20848 }
20849
20850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20851         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
20852         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20853         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
20854         return tag_ptr(ret_conv, true);
20855 }
20856
20857 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
20858         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
20859         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
20860         return tag_ptr(ret_conv, true);
20861 }
20862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20863         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
20864         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
20865         return ret_conv;
20866 }
20867
20868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20869         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
20870         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
20871         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
20872         return tag_ptr(ret_conv, true);
20873 }
20874
20875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
20876         LDKCVec_u8Z b_ref;
20877         b_ref.datalen = (*env)->GetArrayLength(env, b);
20878         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20879         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20880         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
20881         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
20882         return tag_ptr(ret_conv, true);
20883 }
20884
20885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20886         if (!ptr_is_owned(_res)) return;
20887         void* _res_ptr = untag_ptr(_res);
20888         CHECK_ACCESS(_res_ptr);
20889         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
20890         FREE(untag_ptr(_res));
20891         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
20892 }
20893
20894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20895         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
20896         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20897         if (_res_constr.datalen > 0)
20898                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
20899         else
20900                 _res_constr.data = NULL;
20901         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20902         for (size_t x = 0; x < _res_constr.datalen; x++) {
20903                 int64_t _res_conv_23 = _res_vals[x];
20904                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
20905                 CHECK_ACCESS(_res_conv_23_ptr);
20906                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
20907                 FREE(untag_ptr(_res_conv_23));
20908                 _res_constr.data[x] = _res_conv_23_conv;
20909         }
20910         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20911         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
20912 }
20913
20914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20915         LDKRecipientOnionFields o_conv;
20916         o_conv.inner = untag_ptr(o);
20917         o_conv.is_owned = ptr_is_owned(o);
20918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20919         o_conv = RecipientOnionFields_clone(&o_conv);
20920         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20921         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
20922         return tag_ptr(ret_conv, true);
20923 }
20924
20925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
20926         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20927         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
20928         return tag_ptr(ret_conv, true);
20929 }
20930
20931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20932         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
20933         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
20934         return ret_conv;
20935 }
20936
20937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20938         if (!ptr_is_owned(_res)) return;
20939         void* _res_ptr = untag_ptr(_res);
20940         CHECK_ACCESS(_res_ptr);
20941         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
20942         FREE(untag_ptr(_res));
20943         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
20944 }
20945
20946 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
20947         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20948         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
20949         return tag_ptr(ret_conv, true);
20950 }
20951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20952         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
20953         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
20954         return ret_conv;
20955 }
20956
20957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20958         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
20959         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20960         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
20961         return tag_ptr(ret_conv, true);
20962 }
20963
20964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20965         LDKCVec_ThirtyTwoBytesZ _res_constr;
20966         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20967         if (_res_constr.datalen > 0)
20968                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20969         else
20970                 _res_constr.data = NULL;
20971         for (size_t i = 0; i < _res_constr.datalen; i++) {
20972                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20973                 LDKThirtyTwoBytes _res_conv_8_ref;
20974                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
20975                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
20976                 _res_constr.data[i] = _res_conv_8_ref;
20977         }
20978         CVec_ThirtyTwoBytesZ_free(_res_constr);
20979 }
20980
20981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
20982         LDKCVec_ThirtyTwoBytesZ o_constr;
20983         o_constr.datalen = (*env)->GetArrayLength(env, o);
20984         if (o_constr.datalen > 0)
20985                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20986         else
20987                 o_constr.data = NULL;
20988         for (size_t i = 0; i < o_constr.datalen; i++) {
20989                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
20990                 LDKThirtyTwoBytes o_conv_8_ref;
20991                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
20992                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
20993                 o_constr.data[i] = o_conv_8_ref;
20994         }
20995         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
20996         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
20997         int64_t ret_ref = tag_ptr(ret_copy, true);
20998         return ret_ref;
20999 }
21000
21001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
21002         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21003         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
21004         int64_t ret_ref = tag_ptr(ret_copy, true);
21005         return ret_ref;
21006 }
21007
21008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21009         if (!ptr_is_owned(_res)) return;
21010         void* _res_ptr = untag_ptr(_res);
21011         CHECK_ACCESS(_res_ptr);
21012         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
21013         FREE(untag_ptr(_res));
21014         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
21015 }
21016
21017 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21018         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21019         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
21020         int64_t ret_ref = tag_ptr(ret_copy, true);
21021         return ret_ref;
21022 }
21023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21024         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
21025         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21026         return ret_conv;
21027 }
21028
21029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21030         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
21031         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21032         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
21033         int64_t ret_ref = tag_ptr(ret_copy, true);
21034         return ret_ref;
21035 }
21036
21037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21038         LDKThirtyTwoBytes o_ref;
21039         CHECK((*env)->GetArrayLength(env, o) == 32);
21040         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21041         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21042         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
21043         return tag_ptr(ret_conv, true);
21044 }
21045
21046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
21047         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21048         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
21049         return tag_ptr(ret_conv, true);
21050 }
21051
21052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21053         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
21054         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
21055         return ret_conv;
21056 }
21057
21058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21059         if (!ptr_is_owned(_res)) return;
21060         void* _res_ptr = untag_ptr(_res);
21061         CHECK_ACCESS(_res_ptr);
21062         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
21063         FREE(untag_ptr(_res));
21064         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
21065 }
21066
21067 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
21068         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21069         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
21070         return tag_ptr(ret_conv, true);
21071 }
21072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21073         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
21074         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
21075         return ret_conv;
21076 }
21077
21078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21079         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
21080         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21081         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
21082         return tag_ptr(ret_conv, true);
21083 }
21084
21085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21086         LDKBlindedPayInfo o_conv;
21087         o_conv.inner = untag_ptr(o);
21088         o_conv.is_owned = ptr_is_owned(o);
21089         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21090         o_conv = BlindedPayInfo_clone(&o_conv);
21091         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21092         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
21093         return tag_ptr(ret_conv, true);
21094 }
21095
21096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21097         void* e_ptr = untag_ptr(e);
21098         CHECK_ACCESS(e_ptr);
21099         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21100         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21101         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21102         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
21103         return tag_ptr(ret_conv, true);
21104 }
21105
21106 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21107         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
21108         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
21109         return ret_conv;
21110 }
21111
21112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21113         if (!ptr_is_owned(_res)) return;
21114         void* _res_ptr = untag_ptr(_res);
21115         CHECK_ACCESS(_res_ptr);
21116         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
21117         FREE(untag_ptr(_res));
21118         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
21119 }
21120
21121 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
21122         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21123         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
21124         return tag_ptr(ret_conv, true);
21125 }
21126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21127         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
21128         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
21129         return ret_conv;
21130 }
21131
21132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21133         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
21134         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21135         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
21136         return tag_ptr(ret_conv, true);
21137 }
21138
21139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21140         LDKDelayedPaymentOutputDescriptor o_conv;
21141         o_conv.inner = untag_ptr(o);
21142         o_conv.is_owned = ptr_is_owned(o);
21143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21144         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
21145         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21146         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21147         return tag_ptr(ret_conv, true);
21148 }
21149
21150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21151         void* e_ptr = untag_ptr(e);
21152         CHECK_ACCESS(e_ptr);
21153         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21154         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21155         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21156         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21157         return tag_ptr(ret_conv, true);
21158 }
21159
21160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21161         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21162         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21163         return ret_conv;
21164 }
21165
21166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21167         if (!ptr_is_owned(_res)) return;
21168         void* _res_ptr = untag_ptr(_res);
21169         CHECK_ACCESS(_res_ptr);
21170         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21171         FREE(untag_ptr(_res));
21172         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21173 }
21174
21175 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21176         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21177         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21178         return tag_ptr(ret_conv, true);
21179 }
21180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21181         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21182         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21183         return ret_conv;
21184 }
21185
21186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21187         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21188         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21189         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21190         return tag_ptr(ret_conv, true);
21191 }
21192
21193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21194         LDKStaticPaymentOutputDescriptor o_conv;
21195         o_conv.inner = untag_ptr(o);
21196         o_conv.is_owned = ptr_is_owned(o);
21197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21198         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
21199         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21200         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21201         return tag_ptr(ret_conv, true);
21202 }
21203
21204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21205         void* e_ptr = untag_ptr(e);
21206         CHECK_ACCESS(e_ptr);
21207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21209         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21210         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21211         return tag_ptr(ret_conv, true);
21212 }
21213
21214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21215         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21216         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21217         return ret_conv;
21218 }
21219
21220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21221         if (!ptr_is_owned(_res)) return;
21222         void* _res_ptr = untag_ptr(_res);
21223         CHECK_ACCESS(_res_ptr);
21224         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21225         FREE(untag_ptr(_res));
21226         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21227 }
21228
21229 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21230         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21231         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21232         return tag_ptr(ret_conv, true);
21233 }
21234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21235         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21236         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21237         return ret_conv;
21238 }
21239
21240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21241         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21242         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21243         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21244         return tag_ptr(ret_conv, true);
21245 }
21246
21247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21248         void* o_ptr = untag_ptr(o);
21249         CHECK_ACCESS(o_ptr);
21250         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
21251         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
21252         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21253         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
21254         return tag_ptr(ret_conv, true);
21255 }
21256
21257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21258         void* e_ptr = untag_ptr(e);
21259         CHECK_ACCESS(e_ptr);
21260         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21261         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21262         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21263         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
21264         return tag_ptr(ret_conv, true);
21265 }
21266
21267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21268         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21269         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21270         return ret_conv;
21271 }
21272
21273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21274         if (!ptr_is_owned(_res)) return;
21275         void* _res_ptr = untag_ptr(_res);
21276         CHECK_ACCESS(_res_ptr);
21277         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
21278         FREE(untag_ptr(_res));
21279         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
21280 }
21281
21282 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21283         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21284         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
21285         return tag_ptr(ret_conv, true);
21286 }
21287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21288         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21289         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21290         return ret_conv;
21291 }
21292
21293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21294         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21295         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21296         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
21297         return tag_ptr(ret_conv, true);
21298 }
21299
21300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21301         LDKCVec_SpendableOutputDescriptorZ _res_constr;
21302         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21303         if (_res_constr.datalen > 0)
21304                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21305         else
21306                 _res_constr.data = NULL;
21307         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21308         for (size_t b = 0; b < _res_constr.datalen; b++) {
21309                 int64_t _res_conv_27 = _res_vals[b];
21310                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
21311                 CHECK_ACCESS(_res_conv_27_ptr);
21312                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
21313                 FREE(untag_ptr(_res_conv_27));
21314                 _res_constr.data[b] = _res_conv_27_conv;
21315         }
21316         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21317         CVec_SpendableOutputDescriptorZ_free(_res_constr);
21318 }
21319
21320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21321         LDKCVec_TxOutZ _res_constr;
21322         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21323         if (_res_constr.datalen > 0)
21324                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
21325         else
21326                 _res_constr.data = NULL;
21327         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21328         for (size_t h = 0; h < _res_constr.datalen; h++) {
21329                 int64_t _res_conv_7 = _res_vals[h];
21330                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
21331                 CHECK_ACCESS(_res_conv_7_ptr);
21332                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
21333                 FREE(untag_ptr(_res_conv_7));
21334                 _res_constr.data[h] = _res_conv_7_conv;
21335         }
21336         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21337         CVec_TxOutZ_free(_res_constr);
21338 }
21339
21340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
21341         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21342         *ret_copy = COption_u32Z_some(o);
21343         int64_t ret_ref = tag_ptr(ret_copy, true);
21344         return ret_ref;
21345 }
21346
21347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
21348         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21349         *ret_copy = COption_u32Z_none();
21350         int64_t ret_ref = tag_ptr(ret_copy, true);
21351         return ret_ref;
21352 }
21353
21354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21355         if (!ptr_is_owned(_res)) return;
21356         void* _res_ptr = untag_ptr(_res);
21357         CHECK_ACCESS(_res_ptr);
21358         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
21359         FREE(untag_ptr(_res));
21360         COption_u32Z_free(_res_conv);
21361 }
21362
21363 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
21364         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21365         *ret_copy = COption_u32Z_clone(arg);
21366         int64_t ret_ref = tag_ptr(ret_copy, true);
21367         return ret_ref;
21368 }
21369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21370         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
21371         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
21372         return ret_conv;
21373 }
21374
21375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21376         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
21377         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21378         *ret_copy = COption_u32Z_clone(orig_conv);
21379         int64_t ret_ref = tag_ptr(ret_copy, true);
21380         return ret_ref;
21381 }
21382
21383 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
21384         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21385         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
21386         return tag_ptr(ret_conv, true);
21387 }
21388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21389         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
21390         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
21391         return ret_conv;
21392 }
21393
21394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21395         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
21396         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21397         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
21398         return tag_ptr(ret_conv, true);
21399 }
21400
21401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21402         LDKCVec_u8Z a_ref;
21403         a_ref.datalen = (*env)->GetArrayLength(env, a);
21404         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
21405         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
21406         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21407         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
21408         return tag_ptr(ret_conv, true);
21409 }
21410
21411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21412         if (!ptr_is_owned(_res)) return;
21413         void* _res_ptr = untag_ptr(_res);
21414         CHECK_ACCESS(_res_ptr);
21415         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
21416         FREE(untag_ptr(_res));
21417         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
21418 }
21419
21420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21421         void* o_ptr = untag_ptr(o);
21422         CHECK_ACCESS(o_ptr);
21423         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
21424         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
21425         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21426         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
21427         return tag_ptr(ret_conv, true);
21428 }
21429
21430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1err(JNIEnv *env, jclass clz) {
21431         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21432         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
21433         return tag_ptr(ret_conv, true);
21434 }
21435
21436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21437         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
21438         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
21439         return ret_conv;
21440 }
21441
21442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21443         if (!ptr_is_owned(_res)) return;
21444         void* _res_ptr = untag_ptr(_res);
21445         CHECK_ACCESS(_res_ptr);
21446         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
21447         FREE(untag_ptr(_res));
21448         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
21449 }
21450
21451 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
21452         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21453         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
21454         return tag_ptr(ret_conv, true);
21455 }
21456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21457         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
21458         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
21459         return ret_conv;
21460 }
21461
21462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21463         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
21464         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21465         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
21466         return tag_ptr(ret_conv, true);
21467 }
21468
21469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
21470         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21471         *ret_conv = CResult_NoneNoneZ_ok();
21472         return tag_ptr(ret_conv, true);
21473 }
21474
21475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
21476         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21477         *ret_conv = CResult_NoneNoneZ_err();
21478         return tag_ptr(ret_conv, true);
21479 }
21480
21481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21482         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
21483         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
21484         return ret_conv;
21485 }
21486
21487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21488         if (!ptr_is_owned(_res)) return;
21489         void* _res_ptr = untag_ptr(_res);
21490         CHECK_ACCESS(_res_ptr);
21491         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
21492         FREE(untag_ptr(_res));
21493         CResult_NoneNoneZ_free(_res_conv);
21494 }
21495
21496 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
21497         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21498         *ret_conv = CResult_NoneNoneZ_clone(arg);
21499         return tag_ptr(ret_conv, true);
21500 }
21501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21502         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
21503         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
21504         return ret_conv;
21505 }
21506
21507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21508         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
21509         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21510         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
21511         return tag_ptr(ret_conv, true);
21512 }
21513
21514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21515         LDKCVec_ECDSASignatureZ _res_constr;
21516         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21517         if (_res_constr.datalen > 0)
21518                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21519         else
21520                 _res_constr.data = NULL;
21521         for (size_t i = 0; i < _res_constr.datalen; i++) {
21522                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21523                 LDKECDSASignature _res_conv_8_ref;
21524                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
21525                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
21526                 _res_constr.data[i] = _res_conv_8_ref;
21527         }
21528         CVec_ECDSASignatureZ_free(_res_constr);
21529 }
21530
21531 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
21532         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21533         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
21534         return tag_ptr(ret_conv, true);
21535 }
21536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21537         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
21538         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
21539         return ret_conv;
21540 }
21541
21542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21543         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
21544         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21545         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
21546         return tag_ptr(ret_conv, true);
21547 }
21548
21549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
21550         LDKECDSASignature a_ref;
21551         CHECK((*env)->GetArrayLength(env, a) == 64);
21552         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
21553         LDKCVec_ECDSASignatureZ b_constr;
21554         b_constr.datalen = (*env)->GetArrayLength(env, b);
21555         if (b_constr.datalen > 0)
21556                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21557         else
21558                 b_constr.data = NULL;
21559         for (size_t i = 0; i < b_constr.datalen; i++) {
21560                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
21561                 LDKECDSASignature b_conv_8_ref;
21562                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
21563                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
21564                 b_constr.data[i] = b_conv_8_ref;
21565         }
21566         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21567         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
21568         return tag_ptr(ret_conv, true);
21569 }
21570
21571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21572         if (!ptr_is_owned(_res)) return;
21573         void* _res_ptr = untag_ptr(_res);
21574         CHECK_ACCESS(_res_ptr);
21575         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
21576         FREE(untag_ptr(_res));
21577         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
21578 }
21579
21580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21581         void* o_ptr = untag_ptr(o);
21582         CHECK_ACCESS(o_ptr);
21583         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
21584         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
21585         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21586         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
21587         return tag_ptr(ret_conv, true);
21588 }
21589
21590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
21591         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21592         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
21593         return tag_ptr(ret_conv, true);
21594 }
21595
21596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21597         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
21598         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
21599         return ret_conv;
21600 }
21601
21602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21603         if (!ptr_is_owned(_res)) return;
21604         void* _res_ptr = untag_ptr(_res);
21605         CHECK_ACCESS(_res_ptr);
21606         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
21607         FREE(untag_ptr(_res));
21608         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
21609 }
21610
21611 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
21612         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21613         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
21614         return tag_ptr(ret_conv, true);
21615 }
21616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21617         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
21618         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
21619         return ret_conv;
21620 }
21621
21622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21623         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
21624         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21625         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
21626         return tag_ptr(ret_conv, true);
21627 }
21628
21629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21630         LDKECDSASignature o_ref;
21631         CHECK((*env)->GetArrayLength(env, o) == 64);
21632         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
21633         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21634         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
21635         return tag_ptr(ret_conv, true);
21636 }
21637
21638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
21639         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21640         *ret_conv = CResult_ECDSASignatureNoneZ_err();
21641         return tag_ptr(ret_conv, true);
21642 }
21643
21644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21645         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
21646         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
21647         return ret_conv;
21648 }
21649
21650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21651         if (!ptr_is_owned(_res)) return;
21652         void* _res_ptr = untag_ptr(_res);
21653         CHECK_ACCESS(_res_ptr);
21654         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
21655         FREE(untag_ptr(_res));
21656         CResult_ECDSASignatureNoneZ_free(_res_conv);
21657 }
21658
21659 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
21660         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21661         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
21662         return tag_ptr(ret_conv, true);
21663 }
21664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21665         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
21666         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
21667         return ret_conv;
21668 }
21669
21670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21671         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
21672         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21673         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
21674         return tag_ptr(ret_conv, true);
21675 }
21676
21677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21678         LDKPublicKey o_ref;
21679         CHECK((*env)->GetArrayLength(env, o) == 33);
21680         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
21681         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21682         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
21683         return tag_ptr(ret_conv, true);
21684 }
21685
21686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
21687         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21688         *ret_conv = CResult_PublicKeyNoneZ_err();
21689         return tag_ptr(ret_conv, true);
21690 }
21691
21692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21693         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
21694         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
21695         return ret_conv;
21696 }
21697
21698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21699         if (!ptr_is_owned(_res)) return;
21700         void* _res_ptr = untag_ptr(_res);
21701         CHECK_ACCESS(_res_ptr);
21702         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
21703         FREE(untag_ptr(_res));
21704         CResult_PublicKeyNoneZ_free(_res_conv);
21705 }
21706
21707 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
21708         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21709         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
21710         return tag_ptr(ret_conv, true);
21711 }
21712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21713         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
21714         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
21715         return ret_conv;
21716 }
21717
21718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21719         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
21720         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21721         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
21722         return tag_ptr(ret_conv, true);
21723 }
21724
21725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21726         void* o_ptr = untag_ptr(o);
21727         CHECK_ACCESS(o_ptr);
21728         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
21729         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
21730         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21731         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
21732         int64_t ret_ref = tag_ptr(ret_copy, true);
21733         return ret_ref;
21734 }
21735
21736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
21737         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21738         *ret_copy = COption_BigEndianScalarZ_none();
21739         int64_t ret_ref = tag_ptr(ret_copy, true);
21740         return ret_ref;
21741 }
21742
21743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21744         if (!ptr_is_owned(_res)) return;
21745         void* _res_ptr = untag_ptr(_res);
21746         CHECK_ACCESS(_res_ptr);
21747         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
21748         FREE(untag_ptr(_res));
21749         COption_BigEndianScalarZ_free(_res_conv);
21750 }
21751
21752 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
21753         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21754         *ret_copy = COption_BigEndianScalarZ_clone(arg);
21755         int64_t ret_ref = tag_ptr(ret_copy, true);
21756         return ret_ref;
21757 }
21758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21759         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
21760         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
21761         return ret_conv;
21762 }
21763
21764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21765         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
21766         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21767         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
21768         int64_t ret_ref = tag_ptr(ret_copy, true);
21769         return ret_ref;
21770 }
21771
21772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21773         LDKCVec_U5Z _res_constr;
21774         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21775         if (_res_constr.datalen > 0)
21776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
21777         else
21778                 _res_constr.data = NULL;
21779         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
21780         for (size_t h = 0; h < _res_constr.datalen; h++) {
21781                 int8_t _res_conv_7 = _res_vals[h];
21782                 
21783                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
21784         }
21785         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
21786         CVec_U5Z_free(_res_constr);
21787 }
21788
21789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21790         LDKRecoverableSignature o_ref;
21791         CHECK((*env)->GetArrayLength(env, o) == 68);
21792         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
21793         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21794         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
21795         return tag_ptr(ret_conv, true);
21796 }
21797
21798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
21799         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21800         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
21801         return tag_ptr(ret_conv, true);
21802 }
21803
21804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21805         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
21806         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
21807         return ret_conv;
21808 }
21809
21810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21811         if (!ptr_is_owned(_res)) return;
21812         void* _res_ptr = untag_ptr(_res);
21813         CHECK_ACCESS(_res_ptr);
21814         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
21815         FREE(untag_ptr(_res));
21816         CResult_RecoverableSignatureNoneZ_free(_res_conv);
21817 }
21818
21819 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
21820         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21821         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
21822         return tag_ptr(ret_conv, true);
21823 }
21824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21825         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
21826         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
21827         return ret_conv;
21828 }
21829
21830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21831         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
21832         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21833         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
21834         return tag_ptr(ret_conv, true);
21835 }
21836
21837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21838         LDKSchnorrSignature o_ref;
21839         CHECK((*env)->GetArrayLength(env, o) == 64);
21840         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
21841         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21842         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
21843         return tag_ptr(ret_conv, true);
21844 }
21845
21846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
21847         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21848         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
21849         return tag_ptr(ret_conv, true);
21850 }
21851
21852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21853         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
21854         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
21855         return ret_conv;
21856 }
21857
21858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21859         if (!ptr_is_owned(_res)) return;
21860         void* _res_ptr = untag_ptr(_res);
21861         CHECK_ACCESS(_res_ptr);
21862         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
21863         FREE(untag_ptr(_res));
21864         CResult_SchnorrSignatureNoneZ_free(_res_conv);
21865 }
21866
21867 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
21868         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21869         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
21870         return tag_ptr(ret_conv, true);
21871 }
21872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21873         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
21874         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
21875         return ret_conv;
21876 }
21877
21878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21879         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
21880         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21881         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
21882         return tag_ptr(ret_conv, true);
21883 }
21884
21885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21886         void* o_ptr = untag_ptr(o);
21887         CHECK_ACCESS(o_ptr);
21888         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
21889         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
21890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21891                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
21892         }
21893         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21894         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
21895         return tag_ptr(ret_conv, true);
21896 }
21897
21898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21899         void* e_ptr = untag_ptr(e);
21900         CHECK_ACCESS(e_ptr);
21901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21903         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21904         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
21905         return tag_ptr(ret_conv, true);
21906 }
21907
21908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21909         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
21910         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
21911         return ret_conv;
21912 }
21913
21914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21915         if (!ptr_is_owned(_res)) return;
21916         void* _res_ptr = untag_ptr(_res);
21917         CHECK_ACCESS(_res_ptr);
21918         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
21919         FREE(untag_ptr(_res));
21920         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
21921 }
21922
21923 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
21924         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21925         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
21926         return tag_ptr(ret_conv, true);
21927 }
21928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21929         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
21930         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
21931         return ret_conv;
21932 }
21933
21934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21935         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
21936         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21937         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
21938         return tag_ptr(ret_conv, true);
21939 }
21940
21941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21942         LDKCVec_u8Z o_ref;
21943         o_ref.datalen = (*env)->GetArrayLength(env, o);
21944         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21945         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21946         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21947         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
21948         return tag_ptr(ret_conv, true);
21949 }
21950
21951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
21952         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21953         *ret_conv = CResult_CVec_u8ZNoneZ_err();
21954         return tag_ptr(ret_conv, true);
21955 }
21956
21957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21958         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
21959         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
21960         return ret_conv;
21961 }
21962
21963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21964         if (!ptr_is_owned(_res)) return;
21965         void* _res_ptr = untag_ptr(_res);
21966         CHECK_ACCESS(_res_ptr);
21967         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
21968         FREE(untag_ptr(_res));
21969         CResult_CVec_u8ZNoneZ_free(_res_conv);
21970 }
21971
21972 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
21973         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21974         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
21975         return tag_ptr(ret_conv, true);
21976 }
21977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21978         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
21979         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
21980         return ret_conv;
21981 }
21982
21983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21984         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
21985         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21986         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
21987         return tag_ptr(ret_conv, true);
21988 }
21989
21990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21991         LDKShutdownScript o_conv;
21992         o_conv.inner = untag_ptr(o);
21993         o_conv.is_owned = ptr_is_owned(o);
21994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21995         o_conv = ShutdownScript_clone(&o_conv);
21996         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
21997         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
21998         return tag_ptr(ret_conv, true);
21999 }
22000
22001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
22002         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22003         *ret_conv = CResult_ShutdownScriptNoneZ_err();
22004         return tag_ptr(ret_conv, true);
22005 }
22006
22007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22008         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
22009         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
22010         return ret_conv;
22011 }
22012
22013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22014         if (!ptr_is_owned(_res)) return;
22015         void* _res_ptr = untag_ptr(_res);
22016         CHECK_ACCESS(_res_ptr);
22017         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
22018         FREE(untag_ptr(_res));
22019         CResult_ShutdownScriptNoneZ_free(_res_conv);
22020 }
22021
22022 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
22023         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22024         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
22025         return tag_ptr(ret_conv, true);
22026 }
22027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22028         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
22029         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
22030         return ret_conv;
22031 }
22032
22033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22034         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
22035         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22036         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
22037         return tag_ptr(ret_conv, true);
22038 }
22039
22040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
22041         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22042         *ret_copy = COption_u16Z_some(o);
22043         int64_t ret_ref = tag_ptr(ret_copy, true);
22044         return ret_ref;
22045 }
22046
22047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
22048         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22049         *ret_copy = COption_u16Z_none();
22050         int64_t ret_ref = tag_ptr(ret_copy, true);
22051         return ret_ref;
22052 }
22053
22054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22055         if (!ptr_is_owned(_res)) return;
22056         void* _res_ptr = untag_ptr(_res);
22057         CHECK_ACCESS(_res_ptr);
22058         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
22059         FREE(untag_ptr(_res));
22060         COption_u16Z_free(_res_conv);
22061 }
22062
22063 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
22064         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22065         *ret_copy = COption_u16Z_clone(arg);
22066         int64_t ret_ref = tag_ptr(ret_copy, true);
22067         return ret_ref;
22068 }
22069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22070         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
22071         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
22072         return ret_conv;
22073 }
22074
22075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22076         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
22077         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22078         *ret_copy = COption_u16Z_clone(orig_conv);
22079         int64_t ret_ref = tag_ptr(ret_copy, true);
22080         return ret_ref;
22081 }
22082
22083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
22084         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22085         *ret_copy = COption_boolZ_some(o);
22086         int64_t ret_ref = tag_ptr(ret_copy, true);
22087         return ret_ref;
22088 }
22089
22090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
22091         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22092         *ret_copy = COption_boolZ_none();
22093         int64_t ret_ref = tag_ptr(ret_copy, true);
22094         return ret_ref;
22095 }
22096
22097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22098         if (!ptr_is_owned(_res)) return;
22099         void* _res_ptr = untag_ptr(_res);
22100         CHECK_ACCESS(_res_ptr);
22101         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
22102         FREE(untag_ptr(_res));
22103         COption_boolZ_free(_res_conv);
22104 }
22105
22106 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
22107         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22108         *ret_copy = COption_boolZ_clone(arg);
22109         int64_t ret_ref = tag_ptr(ret_copy, true);
22110         return ret_ref;
22111 }
22112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22113         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
22114         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
22115         return ret_conv;
22116 }
22117
22118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22119         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
22120         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22121         *ret_copy = COption_boolZ_clone(orig_conv);
22122         int64_t ret_ref = tag_ptr(ret_copy, true);
22123         return ret_ref;
22124 }
22125
22126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22127         LDKCVec_CVec_u8ZZ _res_constr;
22128         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22129         if (_res_constr.datalen > 0)
22130                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22131         else
22132                 _res_constr.data = NULL;
22133         for (size_t i = 0; i < _res_constr.datalen; i++) {
22134                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22135                 LDKCVec_u8Z _res_conv_8_ref;
22136                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
22137                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22138                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
22139                 _res_constr.data[i] = _res_conv_8_ref;
22140         }
22141         CVec_CVec_u8ZZ_free(_res_constr);
22142 }
22143
22144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
22145         LDKCVec_CVec_u8ZZ o_constr;
22146         o_constr.datalen = (*env)->GetArrayLength(env, o);
22147         if (o_constr.datalen > 0)
22148                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22149         else
22150                 o_constr.data = NULL;
22151         for (size_t i = 0; i < o_constr.datalen; i++) {
22152                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
22153                 LDKCVec_u8Z o_conv_8_ref;
22154                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
22155                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22156                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
22157                 o_constr.data[i] = o_conv_8_ref;
22158         }
22159         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22160         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
22161         return tag_ptr(ret_conv, true);
22162 }
22163
22164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
22165         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22166         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
22167         return tag_ptr(ret_conv, true);
22168 }
22169
22170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22171         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
22172         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
22173         return ret_conv;
22174 }
22175
22176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22177         if (!ptr_is_owned(_res)) return;
22178         void* _res_ptr = untag_ptr(_res);
22179         CHECK_ACCESS(_res_ptr);
22180         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
22181         FREE(untag_ptr(_res));
22182         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
22183 }
22184
22185 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
22186         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22187         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
22188         return tag_ptr(ret_conv, true);
22189 }
22190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22191         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
22192         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
22193         return ret_conv;
22194 }
22195
22196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22197         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
22198         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22199         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
22200         return tag_ptr(ret_conv, true);
22201 }
22202
22203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22204         LDKInMemorySigner o_conv;
22205         o_conv.inner = untag_ptr(o);
22206         o_conv.is_owned = ptr_is_owned(o);
22207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22208         o_conv = InMemorySigner_clone(&o_conv);
22209         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22210         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
22211         return tag_ptr(ret_conv, true);
22212 }
22213
22214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22215         void* e_ptr = untag_ptr(e);
22216         CHECK_ACCESS(e_ptr);
22217         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22218         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22219         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22220         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
22221         return tag_ptr(ret_conv, true);
22222 }
22223
22224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22225         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
22226         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
22227         return ret_conv;
22228 }
22229
22230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22231         if (!ptr_is_owned(_res)) return;
22232         void* _res_ptr = untag_ptr(_res);
22233         CHECK_ACCESS(_res_ptr);
22234         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
22235         FREE(untag_ptr(_res));
22236         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
22237 }
22238
22239 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
22240         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22241         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
22242         return tag_ptr(ret_conv, true);
22243 }
22244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22245         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
22246         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
22247         return ret_conv;
22248 }
22249
22250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22251         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
22252         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22253         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
22254         return tag_ptr(ret_conv, true);
22255 }
22256
22257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22258         LDKTransaction o_ref;
22259         o_ref.datalen = (*env)->GetArrayLength(env, o);
22260         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
22261         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22262         o_ref.data_is_owned = true;
22263         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22264         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
22265         return tag_ptr(ret_conv, true);
22266 }
22267
22268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
22269         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22270         *ret_conv = CResult_TransactionNoneZ_err();
22271         return tag_ptr(ret_conv, true);
22272 }
22273
22274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22275         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
22276         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
22277         return ret_conv;
22278 }
22279
22280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22281         if (!ptr_is_owned(_res)) return;
22282         void* _res_ptr = untag_ptr(_res);
22283         CHECK_ACCESS(_res_ptr);
22284         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
22285         FREE(untag_ptr(_res));
22286         CResult_TransactionNoneZ_free(_res_conv);
22287 }
22288
22289 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
22290         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22291         *ret_conv = CResult_TransactionNoneZ_clone(arg);
22292         return tag_ptr(ret_conv, true);
22293 }
22294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22295         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
22296         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
22297         return ret_conv;
22298 }
22299
22300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22301         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
22302         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22303         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
22304         return tag_ptr(ret_conv, true);
22305 }
22306
22307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22308         void* o_ptr = untag_ptr(o);
22309         CHECK_ACCESS(o_ptr);
22310         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
22311         if (o_conv.free == LDKWriteableScore_JCalls_free) {
22312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22313                 LDKWriteableScore_JCalls_cloned(&o_conv);
22314         }
22315         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22316         *ret_copy = COption_WriteableScoreZ_some(o_conv);
22317         int64_t ret_ref = tag_ptr(ret_copy, true);
22318         return ret_ref;
22319 }
22320
22321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
22322         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22323         *ret_copy = COption_WriteableScoreZ_none();
22324         int64_t ret_ref = tag_ptr(ret_copy, true);
22325         return ret_ref;
22326 }
22327
22328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22329         if (!ptr_is_owned(_res)) return;
22330         void* _res_ptr = untag_ptr(_res);
22331         CHECK_ACCESS(_res_ptr);
22332         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
22333         FREE(untag_ptr(_res));
22334         COption_WriteableScoreZ_free(_res_conv);
22335 }
22336
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
22338         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22339         *ret_conv = CResult_NoneIOErrorZ_ok();
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22344         LDKIOError e_conv = LDKIOError_from_java(env, e);
22345         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22346         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
22347         return tag_ptr(ret_conv, true);
22348 }
22349
22350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22351         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
22352         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
22353         return ret_conv;
22354 }
22355
22356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22357         if (!ptr_is_owned(_res)) return;
22358         void* _res_ptr = untag_ptr(_res);
22359         CHECK_ACCESS(_res_ptr);
22360         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
22361         FREE(untag_ptr(_res));
22362         CResult_NoneIOErrorZ_free(_res_conv);
22363 }
22364
22365 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
22366         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22367         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
22368         return tag_ptr(ret_conv, true);
22369 }
22370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22371         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
22372         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
22373         return ret_conv;
22374 }
22375
22376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22377         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
22378         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22379         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
22380         return tag_ptr(ret_conv, true);
22381 }
22382
22383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22384         LDKCVec_ChannelDetailsZ _res_constr;
22385         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22386         if (_res_constr.datalen > 0)
22387                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22388         else
22389                 _res_constr.data = NULL;
22390         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22391         for (size_t q = 0; q < _res_constr.datalen; q++) {
22392                 int64_t _res_conv_16 = _res_vals[q];
22393                 LDKChannelDetails _res_conv_16_conv;
22394                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22395                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22396                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22397                 _res_constr.data[q] = _res_conv_16_conv;
22398         }
22399         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22400         CVec_ChannelDetailsZ_free(_res_constr);
22401 }
22402
22403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22404         LDKRoute o_conv;
22405         o_conv.inner = untag_ptr(o);
22406         o_conv.is_owned = ptr_is_owned(o);
22407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22408         o_conv = Route_clone(&o_conv);
22409         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22410         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
22411         return tag_ptr(ret_conv, true);
22412 }
22413
22414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22415         LDKLightningError e_conv;
22416         e_conv.inner = untag_ptr(e);
22417         e_conv.is_owned = ptr_is_owned(e);
22418         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22419         e_conv = LightningError_clone(&e_conv);
22420         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22421         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
22422         return tag_ptr(ret_conv, true);
22423 }
22424
22425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22426         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
22427         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
22428         return ret_conv;
22429 }
22430
22431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22432         if (!ptr_is_owned(_res)) return;
22433         void* _res_ptr = untag_ptr(_res);
22434         CHECK_ACCESS(_res_ptr);
22435         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
22436         FREE(untag_ptr(_res));
22437         CResult_RouteLightningErrorZ_free(_res_conv);
22438 }
22439
22440 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
22441         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22442         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
22443         return tag_ptr(ret_conv, true);
22444 }
22445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22446         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
22447         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
22448         return ret_conv;
22449 }
22450
22451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22452         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
22453         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22454         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
22455         return tag_ptr(ret_conv, true);
22456 }
22457
22458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22459         LDKInFlightHtlcs o_conv;
22460         o_conv.inner = untag_ptr(o);
22461         o_conv.is_owned = ptr_is_owned(o);
22462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22463         o_conv = InFlightHtlcs_clone(&o_conv);
22464         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22465         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
22466         return tag_ptr(ret_conv, true);
22467 }
22468
22469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22470         void* e_ptr = untag_ptr(e);
22471         CHECK_ACCESS(e_ptr);
22472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22474         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22475         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
22476         return tag_ptr(ret_conv, true);
22477 }
22478
22479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22480         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
22481         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
22482         return ret_conv;
22483 }
22484
22485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22486         if (!ptr_is_owned(_res)) return;
22487         void* _res_ptr = untag_ptr(_res);
22488         CHECK_ACCESS(_res_ptr);
22489         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
22490         FREE(untag_ptr(_res));
22491         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
22492 }
22493
22494 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
22495         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22496         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
22497         return tag_ptr(ret_conv, true);
22498 }
22499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22500         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
22501         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
22502         return ret_conv;
22503 }
22504
22505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22506         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
22507         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22508         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
22509         return tag_ptr(ret_conv, true);
22510 }
22511
22512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22513         LDKRouteHop o_conv;
22514         o_conv.inner = untag_ptr(o);
22515         o_conv.is_owned = ptr_is_owned(o);
22516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22517         o_conv = RouteHop_clone(&o_conv);
22518         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22519         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
22520         return tag_ptr(ret_conv, true);
22521 }
22522
22523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22524         void* e_ptr = untag_ptr(e);
22525         CHECK_ACCESS(e_ptr);
22526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22528         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22529         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
22530         return tag_ptr(ret_conv, true);
22531 }
22532
22533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22534         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
22535         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
22536         return ret_conv;
22537 }
22538
22539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22540         if (!ptr_is_owned(_res)) return;
22541         void* _res_ptr = untag_ptr(_res);
22542         CHECK_ACCESS(_res_ptr);
22543         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
22544         FREE(untag_ptr(_res));
22545         CResult_RouteHopDecodeErrorZ_free(_res_conv);
22546 }
22547
22548 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
22549         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22550         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
22551         return tag_ptr(ret_conv, true);
22552 }
22553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22554         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
22555         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
22556         return ret_conv;
22557 }
22558
22559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22560         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
22561         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22562         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
22563         return tag_ptr(ret_conv, true);
22564 }
22565
22566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22567         LDKCVec_BlindedHopZ _res_constr;
22568         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22569         if (_res_constr.datalen > 0)
22570                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
22571         else
22572                 _res_constr.data = NULL;
22573         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22574         for (size_t m = 0; m < _res_constr.datalen; m++) {
22575                 int64_t _res_conv_12 = _res_vals[m];
22576                 LDKBlindedHop _res_conv_12_conv;
22577                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
22578                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
22579                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
22580                 _res_constr.data[m] = _res_conv_12_conv;
22581         }
22582         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22583         CVec_BlindedHopZ_free(_res_constr);
22584 }
22585
22586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22587         LDKBlindedTail o_conv;
22588         o_conv.inner = untag_ptr(o);
22589         o_conv.is_owned = ptr_is_owned(o);
22590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22591         o_conv = BlindedTail_clone(&o_conv);
22592         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22593         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
22594         return tag_ptr(ret_conv, true);
22595 }
22596
22597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22598         void* e_ptr = untag_ptr(e);
22599         CHECK_ACCESS(e_ptr);
22600         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22601         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22602         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22603         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
22604         return tag_ptr(ret_conv, true);
22605 }
22606
22607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22608         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
22609         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
22610         return ret_conv;
22611 }
22612
22613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22614         if (!ptr_is_owned(_res)) return;
22615         void* _res_ptr = untag_ptr(_res);
22616         CHECK_ACCESS(_res_ptr);
22617         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
22618         FREE(untag_ptr(_res));
22619         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
22620 }
22621
22622 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
22623         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22624         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
22625         return tag_ptr(ret_conv, true);
22626 }
22627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22628         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
22629         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
22630         return ret_conv;
22631 }
22632
22633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22634         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
22635         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22636         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
22637         return tag_ptr(ret_conv, true);
22638 }
22639
22640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22641         LDKCVec_RouteHopZ _res_constr;
22642         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22643         if (_res_constr.datalen > 0)
22644                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22645         else
22646                 _res_constr.data = NULL;
22647         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22648         for (size_t k = 0; k < _res_constr.datalen; k++) {
22649                 int64_t _res_conv_10 = _res_vals[k];
22650                 LDKRouteHop _res_conv_10_conv;
22651                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
22652                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
22653                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
22654                 _res_constr.data[k] = _res_conv_10_conv;
22655         }
22656         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22657         CVec_RouteHopZ_free(_res_constr);
22658 }
22659
22660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22661         LDKCVec_PathZ _res_constr;
22662         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22663         if (_res_constr.datalen > 0)
22664                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
22665         else
22666                 _res_constr.data = NULL;
22667         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22668         for (size_t g = 0; g < _res_constr.datalen; g++) {
22669                 int64_t _res_conv_6 = _res_vals[g];
22670                 LDKPath _res_conv_6_conv;
22671                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
22672                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
22673                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
22674                 _res_constr.data[g] = _res_conv_6_conv;
22675         }
22676         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22677         CVec_PathZ_free(_res_constr);
22678 }
22679
22680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22681         LDKRoute o_conv;
22682         o_conv.inner = untag_ptr(o);
22683         o_conv.is_owned = ptr_is_owned(o);
22684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22685         o_conv = Route_clone(&o_conv);
22686         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22687         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
22688         return tag_ptr(ret_conv, true);
22689 }
22690
22691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22692         void* e_ptr = untag_ptr(e);
22693         CHECK_ACCESS(e_ptr);
22694         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22695         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22696         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22697         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
22698         return tag_ptr(ret_conv, true);
22699 }
22700
22701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22702         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
22703         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
22704         return ret_conv;
22705 }
22706
22707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22708         if (!ptr_is_owned(_res)) return;
22709         void* _res_ptr = untag_ptr(_res);
22710         CHECK_ACCESS(_res_ptr);
22711         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
22712         FREE(untag_ptr(_res));
22713         CResult_RouteDecodeErrorZ_free(_res_conv);
22714 }
22715
22716 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
22717         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22718         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
22719         return tag_ptr(ret_conv, true);
22720 }
22721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22722         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
22723         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
22724         return ret_conv;
22725 }
22726
22727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22728         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
22729         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22730         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
22731         return tag_ptr(ret_conv, true);
22732 }
22733
22734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22735         LDKRouteParameters o_conv;
22736         o_conv.inner = untag_ptr(o);
22737         o_conv.is_owned = ptr_is_owned(o);
22738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22739         o_conv = RouteParameters_clone(&o_conv);
22740         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22741         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
22742         return tag_ptr(ret_conv, true);
22743 }
22744
22745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22746         void* e_ptr = untag_ptr(e);
22747         CHECK_ACCESS(e_ptr);
22748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22750         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22751         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
22752         return tag_ptr(ret_conv, true);
22753 }
22754
22755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22756         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
22757         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
22758         return ret_conv;
22759 }
22760
22761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22762         if (!ptr_is_owned(_res)) return;
22763         void* _res_ptr = untag_ptr(_res);
22764         CHECK_ACCESS(_res_ptr);
22765         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
22766         FREE(untag_ptr(_res));
22767         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
22768 }
22769
22770 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
22771         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22772         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
22773         return tag_ptr(ret_conv, true);
22774 }
22775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22776         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
22777         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
22778         return ret_conv;
22779 }
22780
22781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22782         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
22783         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22784         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
22785         return tag_ptr(ret_conv, true);
22786 }
22787
22788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22789         LDKCVec_u64Z _res_constr;
22790         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22791         if (_res_constr.datalen > 0)
22792                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22793         else
22794                 _res_constr.data = NULL;
22795         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22796         for (size_t g = 0; g < _res_constr.datalen; g++) {
22797                 int64_t _res_conv_6 = _res_vals[g];
22798                 _res_constr.data[g] = _res_conv_6;
22799         }
22800         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22801         CVec_u64Z_free(_res_constr);
22802 }
22803
22804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22805         LDKPaymentParameters o_conv;
22806         o_conv.inner = untag_ptr(o);
22807         o_conv.is_owned = ptr_is_owned(o);
22808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22809         o_conv = PaymentParameters_clone(&o_conv);
22810         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22811         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
22812         return tag_ptr(ret_conv, true);
22813 }
22814
22815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22816         void* e_ptr = untag_ptr(e);
22817         CHECK_ACCESS(e_ptr);
22818         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22819         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22820         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22821         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
22822         return tag_ptr(ret_conv, true);
22823 }
22824
22825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22826         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
22827         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
22828         return ret_conv;
22829 }
22830
22831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22832         if (!ptr_is_owned(_res)) return;
22833         void* _res_ptr = untag_ptr(_res);
22834         CHECK_ACCESS(_res_ptr);
22835         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
22836         FREE(untag_ptr(_res));
22837         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
22838 }
22839
22840 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
22841         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22842         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
22843         return tag_ptr(ret_conv, true);
22844 }
22845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22846         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
22847         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
22848         return ret_conv;
22849 }
22850
22851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22852         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
22853         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22854         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
22855         return tag_ptr(ret_conv, true);
22856 }
22857
22858 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
22859         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22860         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
22861         return tag_ptr(ret_conv, true);
22862 }
22863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22864         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
22865         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
22866         return ret_conv;
22867 }
22868
22869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22870         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
22871         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22872         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
22873         return tag_ptr(ret_conv, true);
22874 }
22875
22876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22877         LDKBlindedPayInfo a_conv;
22878         a_conv.inner = untag_ptr(a);
22879         a_conv.is_owned = ptr_is_owned(a);
22880         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22881         a_conv = BlindedPayInfo_clone(&a_conv);
22882         LDKBlindedPath b_conv;
22883         b_conv.inner = untag_ptr(b);
22884         b_conv.is_owned = ptr_is_owned(b);
22885         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22886         b_conv = BlindedPath_clone(&b_conv);
22887         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22888         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
22889         return tag_ptr(ret_conv, true);
22890 }
22891
22892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22893         if (!ptr_is_owned(_res)) return;
22894         void* _res_ptr = untag_ptr(_res);
22895         CHECK_ACCESS(_res_ptr);
22896         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
22897         FREE(untag_ptr(_res));
22898         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
22899 }
22900
22901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22902         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
22903         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22904         if (_res_constr.datalen > 0)
22905                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
22906         else
22907                 _res_constr.data = NULL;
22908         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22909         for (size_t l = 0; l < _res_constr.datalen; l++) {
22910                 int64_t _res_conv_37 = _res_vals[l];
22911                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
22912                 CHECK_ACCESS(_res_conv_37_ptr);
22913                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
22914                 FREE(untag_ptr(_res_conv_37));
22915                 _res_constr.data[l] = _res_conv_37_conv;
22916         }
22917         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22918         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
22919 }
22920
22921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22922         LDKCVec_RouteHintZ _res_constr;
22923         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22924         if (_res_constr.datalen > 0)
22925                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
22926         else
22927                 _res_constr.data = NULL;
22928         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22929         for (size_t l = 0; l < _res_constr.datalen; l++) {
22930                 int64_t _res_conv_11 = _res_vals[l];
22931                 LDKRouteHint _res_conv_11_conv;
22932                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
22933                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
22934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
22935                 _res_constr.data[l] = _res_conv_11_conv;
22936         }
22937         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22938         CVec_RouteHintZ_free(_res_constr);
22939 }
22940
22941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22942         LDKCVec_RouteHintHopZ _res_constr;
22943         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22944         if (_res_constr.datalen > 0)
22945                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
22946         else
22947                 _res_constr.data = NULL;
22948         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22949         for (size_t o = 0; o < _res_constr.datalen; o++) {
22950                 int64_t _res_conv_14 = _res_vals[o];
22951                 LDKRouteHintHop _res_conv_14_conv;
22952                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
22953                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
22954                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
22955                 _res_constr.data[o] = _res_conv_14_conv;
22956         }
22957         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22958         CVec_RouteHintHopZ_free(_res_constr);
22959 }
22960
22961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22962         LDKRouteHint o_conv;
22963         o_conv.inner = untag_ptr(o);
22964         o_conv.is_owned = ptr_is_owned(o);
22965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22966         o_conv = RouteHint_clone(&o_conv);
22967         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
22968         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
22969         return tag_ptr(ret_conv, true);
22970 }
22971
22972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22973         void* e_ptr = untag_ptr(e);
22974         CHECK_ACCESS(e_ptr);
22975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22977         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
22978         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
22979         return tag_ptr(ret_conv, true);
22980 }
22981
22982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22983         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
22984         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
22985         return ret_conv;
22986 }
22987
22988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22989         if (!ptr_is_owned(_res)) return;
22990         void* _res_ptr = untag_ptr(_res);
22991         CHECK_ACCESS(_res_ptr);
22992         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
22993         FREE(untag_ptr(_res));
22994         CResult_RouteHintDecodeErrorZ_free(_res_conv);
22995 }
22996
22997 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
22998         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
22999         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
23000         return tag_ptr(ret_conv, true);
23001 }
23002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23003         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
23004         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
23005         return ret_conv;
23006 }
23007
23008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23009         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
23010         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23011         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
23012         return tag_ptr(ret_conv, true);
23013 }
23014
23015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23016         LDKRouteHintHop o_conv;
23017         o_conv.inner = untag_ptr(o);
23018         o_conv.is_owned = ptr_is_owned(o);
23019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23020         o_conv = RouteHintHop_clone(&o_conv);
23021         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23022         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
23023         return tag_ptr(ret_conv, true);
23024 }
23025
23026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23027         void* e_ptr = untag_ptr(e);
23028         CHECK_ACCESS(e_ptr);
23029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23031         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23032         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
23033         return tag_ptr(ret_conv, true);
23034 }
23035
23036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23037         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
23038         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
23039         return ret_conv;
23040 }
23041
23042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23043         if (!ptr_is_owned(_res)) return;
23044         void* _res_ptr = untag_ptr(_res);
23045         CHECK_ACCESS(_res_ptr);
23046         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
23047         FREE(untag_ptr(_res));
23048         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
23049 }
23050
23051 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
23052         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23053         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
23054         return tag_ptr(ret_conv, true);
23055 }
23056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23057         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
23058         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
23059         return ret_conv;
23060 }
23061
23062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23063         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
23064         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23065         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
23066         return tag_ptr(ret_conv, true);
23067 }
23068
23069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23070         LDKCVec_PublicKeyZ _res_constr;
23071         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23072         if (_res_constr.datalen > 0)
23073                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
23074         else
23075                 _res_constr.data = NULL;
23076         for (size_t i = 0; i < _res_constr.datalen; i++) {
23077                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
23078                 LDKPublicKey _res_conv_8_ref;
23079                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
23080                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
23081                 _res_constr.data[i] = _res_conv_8_ref;
23082         }
23083         CVec_PublicKeyZ_free(_res_constr);
23084 }
23085
23086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23087         LDKFixedPenaltyScorer o_conv;
23088         o_conv.inner = untag_ptr(o);
23089         o_conv.is_owned = ptr_is_owned(o);
23090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23091         o_conv = FixedPenaltyScorer_clone(&o_conv);
23092         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23093         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
23094         return tag_ptr(ret_conv, true);
23095 }
23096
23097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23098         void* e_ptr = untag_ptr(e);
23099         CHECK_ACCESS(e_ptr);
23100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23102         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23103         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
23104         return tag_ptr(ret_conv, true);
23105 }
23106
23107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23108         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
23109         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
23110         return ret_conv;
23111 }
23112
23113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23114         if (!ptr_is_owned(_res)) return;
23115         void* _res_ptr = untag_ptr(_res);
23116         CHECK_ACCESS(_res_ptr);
23117         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
23118         FREE(untag_ptr(_res));
23119         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
23120 }
23121
23122 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
23123         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23124         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
23125         return tag_ptr(ret_conv, true);
23126 }
23127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23128         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
23129         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
23130         return ret_conv;
23131 }
23132
23133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23134         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
23135         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23136         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
23137         return tag_ptr(ret_conv, true);
23138 }
23139
23140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23141         LDKCVec_NodeIdZ _res_constr;
23142         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23143         if (_res_constr.datalen > 0)
23144                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
23145         else
23146                 _res_constr.data = NULL;
23147         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23148         for (size_t i = 0; i < _res_constr.datalen; i++) {
23149                 int64_t _res_conv_8 = _res_vals[i];
23150                 LDKNodeId _res_conv_8_conv;
23151                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
23152                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
23153                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
23154                 _res_constr.data[i] = _res_conv_8_conv;
23155         }
23156         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23157         CVec_NodeIdZ_free(_res_constr);
23158 }
23159
23160 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
23161         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23162         *ret_conv = C2Tuple_u64u64Z_clone(arg);
23163         return tag_ptr(ret_conv, true);
23164 }
23165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23166         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
23167         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
23168         return ret_conv;
23169 }
23170
23171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23172         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
23173         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23174         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
23175         return tag_ptr(ret_conv, true);
23176 }
23177
23178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23179         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23180         *ret_conv = C2Tuple_u64u64Z_new(a, b);
23181         return tag_ptr(ret_conv, true);
23182 }
23183
23184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23185         if (!ptr_is_owned(_res)) return;
23186         void* _res_ptr = untag_ptr(_res);
23187         CHECK_ACCESS(_res_ptr);
23188         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
23189         FREE(untag_ptr(_res));
23190         C2Tuple_u64u64Z_free(_res_conv);
23191 }
23192
23193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23194         void* o_ptr = untag_ptr(o);
23195         CHECK_ACCESS(o_ptr);
23196         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
23197         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
23198         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23199         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
23200         int64_t ret_ref = tag_ptr(ret_copy, true);
23201         return ret_ref;
23202 }
23203
23204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
23205         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23206         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
23207         int64_t ret_ref = tag_ptr(ret_copy, true);
23208         return ret_ref;
23209 }
23210
23211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23212         if (!ptr_is_owned(_res)) return;
23213         void* _res_ptr = untag_ptr(_res);
23214         CHECK_ACCESS(_res_ptr);
23215         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
23216         FREE(untag_ptr(_res));
23217         COption_C2Tuple_u64u64ZZ_free(_res_conv);
23218 }
23219
23220 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
23221         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23222         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
23223         int64_t ret_ref = tag_ptr(ret_copy, true);
23224         return ret_ref;
23225 }
23226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23227         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
23228         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
23229         return ret_conv;
23230 }
23231
23232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23233         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
23234         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23235         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
23236         int64_t ret_ref = tag_ptr(ret_copy, true);
23237         return ret_ref;
23238 }
23239
23240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23241         LDKThirtyTwoU16s a_ref;
23242         CHECK((*env)->GetArrayLength(env, a) == 32);
23243         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23244         LDKThirtyTwoU16s b_ref;
23245         CHECK((*env)->GetArrayLength(env, b) == 32);
23246         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23247         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
23248         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
23249         return tag_ptr(ret_conv, true);
23250 }
23251
23252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23253         if (!ptr_is_owned(_res)) return;
23254         void* _res_ptr = untag_ptr(_res);
23255         CHECK_ACCESS(_res_ptr);
23256         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
23257         FREE(untag_ptr(_res));
23258         C2Tuple_Z_free(_res_conv);
23259 }
23260
23261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23262         LDKThirtyTwoU16s a_ref;
23263         CHECK((*env)->GetArrayLength(env, a) == 32);
23264         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23265         LDKThirtyTwoU16s b_ref;
23266         CHECK((*env)->GetArrayLength(env, b) == 32);
23267         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23268         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
23269         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
23270         return tag_ptr(ret_conv, true);
23271 }
23272
23273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23274         if (!ptr_is_owned(_res)) return;
23275         void* _res_ptr = untag_ptr(_res);
23276         CHECK_ACCESS(_res_ptr);
23277         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
23278         FREE(untag_ptr(_res));
23279         C2Tuple__u1632_u1632Z_free(_res_conv);
23280 }
23281
23282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23283         void* o_ptr = untag_ptr(o);
23284         CHECK_ACCESS(o_ptr);
23285         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
23286         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
23287         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23288         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
23289         int64_t ret_ref = tag_ptr(ret_copy, true);
23290         return ret_ref;
23291 }
23292
23293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
23294         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23295         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
23296         int64_t ret_ref = tag_ptr(ret_copy, true);
23297         return ret_ref;
23298 }
23299
23300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23301         if (!ptr_is_owned(_res)) return;
23302         void* _res_ptr = untag_ptr(_res);
23303         CHECK_ACCESS(_res_ptr);
23304         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
23305         FREE(untag_ptr(_res));
23306         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
23307 }
23308
23309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
23310         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23311         *ret_copy = COption_f64Z_some(o);
23312         int64_t ret_ref = tag_ptr(ret_copy, true);
23313         return ret_ref;
23314 }
23315
23316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
23317         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23318         *ret_copy = COption_f64Z_none();
23319         int64_t ret_ref = tag_ptr(ret_copy, true);
23320         return ret_ref;
23321 }
23322
23323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23324         if (!ptr_is_owned(_res)) return;
23325         void* _res_ptr = untag_ptr(_res);
23326         CHECK_ACCESS(_res_ptr);
23327         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
23328         FREE(untag_ptr(_res));
23329         COption_f64Z_free(_res_conv);
23330 }
23331
23332 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
23333         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23334         *ret_copy = COption_f64Z_clone(arg);
23335         int64_t ret_ref = tag_ptr(ret_copy, true);
23336         return ret_ref;
23337 }
23338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23339         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
23340         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
23341         return ret_conv;
23342 }
23343
23344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23345         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
23346         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23347         *ret_copy = COption_f64Z_clone(orig_conv);
23348         int64_t ret_ref = tag_ptr(ret_copy, true);
23349         return ret_ref;
23350 }
23351
23352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23353         LDKProbabilisticScorer o_conv;
23354         o_conv.inner = untag_ptr(o);
23355         o_conv.is_owned = ptr_is_owned(o);
23356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23357         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
23358         
23359         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23360         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
23361         return tag_ptr(ret_conv, true);
23362 }
23363
23364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23365         void* e_ptr = untag_ptr(e);
23366         CHECK_ACCESS(e_ptr);
23367         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23368         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23369         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23370         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
23371         return tag_ptr(ret_conv, true);
23372 }
23373
23374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23375         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
23376         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
23377         return ret_conv;
23378 }
23379
23380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23381         if (!ptr_is_owned(_res)) return;
23382         void* _res_ptr = untag_ptr(_res);
23383         CHECK_ACCESS(_res_ptr);
23384         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
23385         FREE(untag_ptr(_res));
23386         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
23387 }
23388
23389 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
23390         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23391         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
23392         return tag_ptr(ret_conv, true);
23393 }
23394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23395         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
23396         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
23397         return ret_conv;
23398 }
23399
23400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23401         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
23402         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23403         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
23404         return tag_ptr(ret_conv, true);
23405 }
23406
23407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
23408         LDKTransaction b_ref;
23409         b_ref.datalen = (*env)->GetArrayLength(env, b);
23410         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
23411         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
23412         b_ref.data_is_owned = true;
23413         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23414         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
23415         return tag_ptr(ret_conv, true);
23416 }
23417
23418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23419         if (!ptr_is_owned(_res)) return;
23420         void* _res_ptr = untag_ptr(_res);
23421         CHECK_ACCESS(_res_ptr);
23422         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
23423         FREE(untag_ptr(_res));
23424         C2Tuple_usizeTransactionZ_free(_res_conv);
23425 }
23426
23427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23428         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
23429         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23430         if (_res_constr.datalen > 0)
23431                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23432         else
23433                 _res_constr.data = NULL;
23434         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23435         for (size_t c = 0; c < _res_constr.datalen; c++) {
23436                 int64_t _res_conv_28 = _res_vals[c];
23437                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
23438                 CHECK_ACCESS(_res_conv_28_ptr);
23439                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
23440                 FREE(untag_ptr(_res_conv_28));
23441                 _res_constr.data[c] = _res_conv_28_conv;
23442         }
23443         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23444         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
23445 }
23446
23447 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
23448         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23449         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
23450         return tag_ptr(ret_conv, true);
23451 }
23452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23453         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
23454         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
23455         return ret_conv;
23456 }
23457
23458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23459         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
23460         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23461         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
23462         return tag_ptr(ret_conv, true);
23463 }
23464
23465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23466         LDKThirtyTwoBytes a_ref;
23467         CHECK((*env)->GetArrayLength(env, a) == 32);
23468         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23469         void* b_ptr = untag_ptr(b);
23470         CHECK_ACCESS(b_ptr);
23471         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
23472         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
23473         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23474         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
23475         return tag_ptr(ret_conv, true);
23476 }
23477
23478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23479         if (!ptr_is_owned(_res)) return;
23480         void* _res_ptr = untag_ptr(_res);
23481         CHECK_ACCESS(_res_ptr);
23482         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
23483         FREE(untag_ptr(_res));
23484         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
23485 }
23486
23487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23488         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
23489         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23490         if (_res_constr.datalen > 0)
23491                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
23492         else
23493                 _res_constr.data = NULL;
23494         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23495         for (size_t x = 0; x < _res_constr.datalen; x++) {
23496                 int64_t _res_conv_49 = _res_vals[x];
23497                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23498                 CHECK_ACCESS(_res_conv_49_ptr);
23499                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
23500                 FREE(untag_ptr(_res_conv_49));
23501                 _res_constr.data[x] = _res_conv_49_conv;
23502         }
23503         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23504         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
23505 }
23506
23507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
23508         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
23509         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23510         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
23511         return tag_ptr(ret_conv, true);
23512 }
23513
23514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
23515         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23516         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
23517         return tag_ptr(ret_conv, true);
23518 }
23519
23520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23521         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
23522         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
23523         return ret_conv;
23524 }
23525
23526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23527         if (!ptr_is_owned(_res)) return;
23528         void* _res_ptr = untag_ptr(_res);
23529         CHECK_ACCESS(_res_ptr);
23530         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
23531         FREE(untag_ptr(_res));
23532         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
23533 }
23534
23535 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
23536         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23537         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
23538         return tag_ptr(ret_conv, true);
23539 }
23540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23541         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
23542         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
23543         return ret_conv;
23544 }
23545
23546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23547         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
23548         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23549         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
23550         return tag_ptr(ret_conv, true);
23551 }
23552
23553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23554         LDKCVec_MonitorEventZ _res_constr;
23555         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23556         if (_res_constr.datalen > 0)
23557                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
23558         else
23559                 _res_constr.data = NULL;
23560         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23561         for (size_t o = 0; o < _res_constr.datalen; o++) {
23562                 int64_t _res_conv_14 = _res_vals[o];
23563                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
23564                 CHECK_ACCESS(_res_conv_14_ptr);
23565                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
23566                 FREE(untag_ptr(_res_conv_14));
23567                 _res_constr.data[o] = _res_conv_14_conv;
23568         }
23569         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23570         CVec_MonitorEventZ_free(_res_constr);
23571 }
23572
23573 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
23574         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23575         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
23576         return tag_ptr(ret_conv, true);
23577 }
23578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23579         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
23580         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
23581         return ret_conv;
23582 }
23583
23584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23585         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
23586         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23587         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
23588         return tag_ptr(ret_conv, true);
23589 }
23590
23591 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) {
23592         LDKOutPoint a_conv;
23593         a_conv.inner = untag_ptr(a);
23594         a_conv.is_owned = ptr_is_owned(a);
23595         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23596         a_conv = OutPoint_clone(&a_conv);
23597         LDKCVec_MonitorEventZ b_constr;
23598         b_constr.datalen = (*env)->GetArrayLength(env, b);
23599         if (b_constr.datalen > 0)
23600                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
23601         else
23602                 b_constr.data = NULL;
23603         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
23604         for (size_t o = 0; o < b_constr.datalen; o++) {
23605                 int64_t b_conv_14 = b_vals[o];
23606                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
23607                 CHECK_ACCESS(b_conv_14_ptr);
23608                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
23609                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
23610                 b_constr.data[o] = b_conv_14_conv;
23611         }
23612         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
23613         LDKPublicKey c_ref;
23614         CHECK((*env)->GetArrayLength(env, c) == 33);
23615         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
23616         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23617         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
23618         return tag_ptr(ret_conv, true);
23619 }
23620
23621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23622         if (!ptr_is_owned(_res)) return;
23623         void* _res_ptr = untag_ptr(_res);
23624         CHECK_ACCESS(_res_ptr);
23625         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
23626         FREE(untag_ptr(_res));
23627         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
23628 }
23629
23630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23631         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
23632         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23633         if (_res_constr.datalen > 0)
23634                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
23635         else
23636                 _res_constr.data = NULL;
23637         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23638         for (size_t x = 0; x < _res_constr.datalen; x++) {
23639                 int64_t _res_conv_49 = _res_vals[x];
23640                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23641                 CHECK_ACCESS(_res_conv_49_ptr);
23642                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
23643                 FREE(untag_ptr(_res_conv_49));
23644                 _res_constr.data[x] = _res_conv_49_conv;
23645         }
23646         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23647         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
23648 }
23649
23650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23651         LDKInitFeatures o_conv;
23652         o_conv.inner = untag_ptr(o);
23653         o_conv.is_owned = ptr_is_owned(o);
23654         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23655         o_conv = InitFeatures_clone(&o_conv);
23656         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23657         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
23658         return tag_ptr(ret_conv, true);
23659 }
23660
23661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23662         void* e_ptr = untag_ptr(e);
23663         CHECK_ACCESS(e_ptr);
23664         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23665         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23666         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23667         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
23668         return tag_ptr(ret_conv, true);
23669 }
23670
23671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23672         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
23673         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
23674         return ret_conv;
23675 }
23676
23677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23678         if (!ptr_is_owned(_res)) return;
23679         void* _res_ptr = untag_ptr(_res);
23680         CHECK_ACCESS(_res_ptr);
23681         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
23682         FREE(untag_ptr(_res));
23683         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
23684 }
23685
23686 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23687         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23688         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
23689         return tag_ptr(ret_conv, true);
23690 }
23691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23692         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
23693         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23694         return ret_conv;
23695 }
23696
23697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23698         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
23699         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23700         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
23701         return tag_ptr(ret_conv, true);
23702 }
23703
23704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23705         LDKChannelFeatures o_conv;
23706         o_conv.inner = untag_ptr(o);
23707         o_conv.is_owned = ptr_is_owned(o);
23708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23709         o_conv = ChannelFeatures_clone(&o_conv);
23710         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23711         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
23712         return tag_ptr(ret_conv, true);
23713 }
23714
23715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23716         void* e_ptr = untag_ptr(e);
23717         CHECK_ACCESS(e_ptr);
23718         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23719         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23720         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23721         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
23722         return tag_ptr(ret_conv, true);
23723 }
23724
23725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23726         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
23727         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
23728         return ret_conv;
23729 }
23730
23731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23732         if (!ptr_is_owned(_res)) return;
23733         void* _res_ptr = untag_ptr(_res);
23734         CHECK_ACCESS(_res_ptr);
23735         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
23736         FREE(untag_ptr(_res));
23737         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
23738 }
23739
23740 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23741         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23742         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
23743         return tag_ptr(ret_conv, true);
23744 }
23745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23746         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
23747         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23748         return ret_conv;
23749 }
23750
23751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23752         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
23753         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23754         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
23755         return tag_ptr(ret_conv, true);
23756 }
23757
23758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23759         LDKNodeFeatures o_conv;
23760         o_conv.inner = untag_ptr(o);
23761         o_conv.is_owned = ptr_is_owned(o);
23762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23763         o_conv = NodeFeatures_clone(&o_conv);
23764         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23765         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
23766         return tag_ptr(ret_conv, true);
23767 }
23768
23769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23770         void* e_ptr = untag_ptr(e);
23771         CHECK_ACCESS(e_ptr);
23772         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23773         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23774         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23775         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
23776         return tag_ptr(ret_conv, true);
23777 }
23778
23779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23780         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
23781         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
23782         return ret_conv;
23783 }
23784
23785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23786         if (!ptr_is_owned(_res)) return;
23787         void* _res_ptr = untag_ptr(_res);
23788         CHECK_ACCESS(_res_ptr);
23789         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
23790         FREE(untag_ptr(_res));
23791         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
23792 }
23793
23794 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23795         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23796         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
23797         return tag_ptr(ret_conv, true);
23798 }
23799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23800         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
23801         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23802         return ret_conv;
23803 }
23804
23805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23806         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
23807         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23808         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
23809         return tag_ptr(ret_conv, true);
23810 }
23811
23812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23813         LDKBolt11InvoiceFeatures o_conv;
23814         o_conv.inner = untag_ptr(o);
23815         o_conv.is_owned = ptr_is_owned(o);
23816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23817         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
23818         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23819         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
23820         return tag_ptr(ret_conv, true);
23821 }
23822
23823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23824         void* e_ptr = untag_ptr(e);
23825         CHECK_ACCESS(e_ptr);
23826         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23827         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23828         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23829         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
23830         return tag_ptr(ret_conv, true);
23831 }
23832
23833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23834         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
23835         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
23836         return ret_conv;
23837 }
23838
23839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23840         if (!ptr_is_owned(_res)) return;
23841         void* _res_ptr = untag_ptr(_res);
23842         CHECK_ACCESS(_res_ptr);
23843         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
23844         FREE(untag_ptr(_res));
23845         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
23846 }
23847
23848 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23849         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23850         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
23851         return tag_ptr(ret_conv, true);
23852 }
23853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23854         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
23855         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23856         return ret_conv;
23857 }
23858
23859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23860         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
23861         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23862         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
23863         return tag_ptr(ret_conv, true);
23864 }
23865
23866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23867         LDKBolt12InvoiceFeatures o_conv;
23868         o_conv.inner = untag_ptr(o);
23869         o_conv.is_owned = ptr_is_owned(o);
23870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23871         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
23872         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23873         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
23874         return tag_ptr(ret_conv, true);
23875 }
23876
23877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23878         void* e_ptr = untag_ptr(e);
23879         CHECK_ACCESS(e_ptr);
23880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23882         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23883         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
23884         return tag_ptr(ret_conv, true);
23885 }
23886
23887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23888         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
23889         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
23890         return ret_conv;
23891 }
23892
23893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23894         if (!ptr_is_owned(_res)) return;
23895         void* _res_ptr = untag_ptr(_res);
23896         CHECK_ACCESS(_res_ptr);
23897         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
23898         FREE(untag_ptr(_res));
23899         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
23900 }
23901
23902 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23903         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23904         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
23905         return tag_ptr(ret_conv, true);
23906 }
23907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23908         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
23909         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23910         return ret_conv;
23911 }
23912
23913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23914         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
23915         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23916         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
23917         return tag_ptr(ret_conv, true);
23918 }
23919
23920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23921         LDKBlindedHopFeatures o_conv;
23922         o_conv.inner = untag_ptr(o);
23923         o_conv.is_owned = ptr_is_owned(o);
23924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23925         o_conv = BlindedHopFeatures_clone(&o_conv);
23926         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23927         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
23928         return tag_ptr(ret_conv, true);
23929 }
23930
23931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23932         void* e_ptr = untag_ptr(e);
23933         CHECK_ACCESS(e_ptr);
23934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23936         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23937         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
23938         return tag_ptr(ret_conv, true);
23939 }
23940
23941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23942         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
23943         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
23944         return ret_conv;
23945 }
23946
23947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23948         if (!ptr_is_owned(_res)) return;
23949         void* _res_ptr = untag_ptr(_res);
23950         CHECK_ACCESS(_res_ptr);
23951         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
23952         FREE(untag_ptr(_res));
23953         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
23954 }
23955
23956 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23957         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23958         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
23959         return tag_ptr(ret_conv, true);
23960 }
23961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23962         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
23963         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23964         return ret_conv;
23965 }
23966
23967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23968         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
23969         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23970         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
23971         return tag_ptr(ret_conv, true);
23972 }
23973
23974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23975         LDKChannelTypeFeatures o_conv;
23976         o_conv.inner = untag_ptr(o);
23977         o_conv.is_owned = ptr_is_owned(o);
23978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23979         o_conv = ChannelTypeFeatures_clone(&o_conv);
23980         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
23981         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
23982         return tag_ptr(ret_conv, true);
23983 }
23984
23985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23986         void* e_ptr = untag_ptr(e);
23987         CHECK_ACCESS(e_ptr);
23988         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23989         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23990         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
23991         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
23992         return tag_ptr(ret_conv, true);
23993 }
23994
23995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23996         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
23997         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
23998         return ret_conv;
23999 }
24000
24001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24002         if (!ptr_is_owned(_res)) return;
24003         void* _res_ptr = untag_ptr(_res);
24004         CHECK_ACCESS(_res_ptr);
24005         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
24006         FREE(untag_ptr(_res));
24007         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
24008 }
24009
24010 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24011         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24012         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
24013         return tag_ptr(ret_conv, true);
24014 }
24015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24016         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
24017         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24018         return ret_conv;
24019 }
24020
24021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24022         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
24023         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24024         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
24025         return tag_ptr(ret_conv, true);
24026 }
24027
24028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24029         LDKOffer o_conv;
24030         o_conv.inner = untag_ptr(o);
24031         o_conv.is_owned = ptr_is_owned(o);
24032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24033         o_conv = Offer_clone(&o_conv);
24034         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24035         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
24036         return tag_ptr(ret_conv, true);
24037 }
24038
24039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24040         LDKBolt12ParseError e_conv;
24041         e_conv.inner = untag_ptr(e);
24042         e_conv.is_owned = ptr_is_owned(e);
24043         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24044         e_conv = Bolt12ParseError_clone(&e_conv);
24045         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24046         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
24047         return tag_ptr(ret_conv, true);
24048 }
24049
24050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24051         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
24052         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
24053         return ret_conv;
24054 }
24055
24056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_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         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
24061         FREE(untag_ptr(_res));
24062         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
24063 }
24064
24065 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
24066         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24067         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
24068         return tag_ptr(ret_conv, true);
24069 }
24070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24071         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
24072         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
24073         return ret_conv;
24074 }
24075
24076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24077         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
24078         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24079         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
24080         return tag_ptr(ret_conv, true);
24081 }
24082
24083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24084         LDKPublicKey o_ref;
24085         CHECK((*env)->GetArrayLength(env, o) == 33);
24086         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
24087         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24088         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
24089         return tag_ptr(ret_conv, true);
24090 }
24091
24092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24093         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
24094         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24095         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
24096         return tag_ptr(ret_conv, true);
24097 }
24098
24099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24100         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
24101         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
24102         return ret_conv;
24103 }
24104
24105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24106         if (!ptr_is_owned(_res)) return;
24107         void* _res_ptr = untag_ptr(_res);
24108         CHECK_ACCESS(_res_ptr);
24109         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
24110         FREE(untag_ptr(_res));
24111         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
24112 }
24113
24114 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
24115         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24116         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
24117         return tag_ptr(ret_conv, true);
24118 }
24119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24120         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
24121         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
24122         return ret_conv;
24123 }
24124
24125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24126         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
24127         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24128         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
24129         return tag_ptr(ret_conv, true);
24130 }
24131
24132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24133         LDKNodeId o_conv;
24134         o_conv.inner = untag_ptr(o);
24135         o_conv.is_owned = ptr_is_owned(o);
24136         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24137         o_conv = NodeId_clone(&o_conv);
24138         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24139         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
24140         return tag_ptr(ret_conv, true);
24141 }
24142
24143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24144         void* e_ptr = untag_ptr(e);
24145         CHECK_ACCESS(e_ptr);
24146         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24147         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24148         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24149         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
24150         return tag_ptr(ret_conv, true);
24151 }
24152
24153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24154         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
24155         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
24156         return ret_conv;
24157 }
24158
24159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_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_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
24164         FREE(untag_ptr(_res));
24165         CResult_NodeIdDecodeErrorZ_free(_res_conv);
24166 }
24167
24168 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
24169         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24170         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
24171         return tag_ptr(ret_conv, true);
24172 }
24173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24174         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
24175         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
24176         return ret_conv;
24177 }
24178
24179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24180         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
24181         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24182         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
24183         return tag_ptr(ret_conv, true);
24184 }
24185
24186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24187         void* o_ptr = untag_ptr(o);
24188         CHECK_ACCESS(o_ptr);
24189         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
24190         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
24191         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24192         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
24193         int64_t ret_ref = tag_ptr(ret_copy, true);
24194         return ret_ref;
24195 }
24196
24197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
24198         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24199         *ret_copy = COption_NetworkUpdateZ_none();
24200         int64_t ret_ref = tag_ptr(ret_copy, true);
24201         return ret_ref;
24202 }
24203
24204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24205         if (!ptr_is_owned(_res)) return;
24206         void* _res_ptr = untag_ptr(_res);
24207         CHECK_ACCESS(_res_ptr);
24208         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
24209         FREE(untag_ptr(_res));
24210         COption_NetworkUpdateZ_free(_res_conv);
24211 }
24212
24213 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
24214         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24215         *ret_copy = COption_NetworkUpdateZ_clone(arg);
24216         int64_t ret_ref = tag_ptr(ret_copy, true);
24217         return ret_ref;
24218 }
24219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24220         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
24221         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
24222         return ret_conv;
24223 }
24224
24225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24226         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
24227         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24228         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
24229         int64_t ret_ref = tag_ptr(ret_copy, true);
24230         return ret_ref;
24231 }
24232
24233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24234         void* o_ptr = untag_ptr(o);
24235         CHECK_ACCESS(o_ptr);
24236         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
24237         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
24238         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24239         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
24240         return tag_ptr(ret_conv, true);
24241 }
24242
24243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24244         void* e_ptr = untag_ptr(e);
24245         CHECK_ACCESS(e_ptr);
24246         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24247         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24248         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24249         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
24250         return tag_ptr(ret_conv, true);
24251 }
24252
24253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24254         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
24255         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
24256         return ret_conv;
24257 }
24258
24259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24260         if (!ptr_is_owned(_res)) return;
24261         void* _res_ptr = untag_ptr(_res);
24262         CHECK_ACCESS(_res_ptr);
24263         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
24264         FREE(untag_ptr(_res));
24265         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
24266 }
24267
24268 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
24269         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24270         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
24271         return tag_ptr(ret_conv, true);
24272 }
24273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24274         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
24275         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
24276         return ret_conv;
24277 }
24278
24279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24280         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
24281         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24282         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
24283         return tag_ptr(ret_conv, true);
24284 }
24285
24286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24287         void* o_ptr = untag_ptr(o);
24288         CHECK_ACCESS(o_ptr);
24289         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
24290         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
24291                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24292                 LDKUtxoLookup_JCalls_cloned(&o_conv);
24293         }
24294         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24295         *ret_copy = COption_UtxoLookupZ_some(o_conv);
24296         int64_t ret_ref = tag_ptr(ret_copy, true);
24297         return ret_ref;
24298 }
24299
24300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
24301         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24302         *ret_copy = COption_UtxoLookupZ_none();
24303         int64_t ret_ref = tag_ptr(ret_copy, true);
24304         return ret_ref;
24305 }
24306
24307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24308         if (!ptr_is_owned(_res)) return;
24309         void* _res_ptr = untag_ptr(_res);
24310         CHECK_ACCESS(_res_ptr);
24311         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
24312         FREE(untag_ptr(_res));
24313         COption_UtxoLookupZ_free(_res_conv);
24314 }
24315
24316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
24317         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24318         *ret_conv = CResult_NoneLightningErrorZ_ok();
24319         return tag_ptr(ret_conv, true);
24320 }
24321
24322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24323         LDKLightningError e_conv;
24324         e_conv.inner = untag_ptr(e);
24325         e_conv.is_owned = ptr_is_owned(e);
24326         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24327         e_conv = LightningError_clone(&e_conv);
24328         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24329         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
24330         return tag_ptr(ret_conv, true);
24331 }
24332
24333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24334         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
24335         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
24336         return ret_conv;
24337 }
24338
24339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24340         if (!ptr_is_owned(_res)) return;
24341         void* _res_ptr = untag_ptr(_res);
24342         CHECK_ACCESS(_res_ptr);
24343         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
24344         FREE(untag_ptr(_res));
24345         CResult_NoneLightningErrorZ_free(_res_conv);
24346 }
24347
24348 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
24349         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24350         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
24351         return tag_ptr(ret_conv, true);
24352 }
24353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24354         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
24355         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
24356         return ret_conv;
24357 }
24358
24359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24360         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
24361         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24362         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
24363         return tag_ptr(ret_conv, true);
24364 }
24365
24366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
24367         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24368         *ret_conv = CResult_boolLightningErrorZ_ok(o);
24369         return tag_ptr(ret_conv, true);
24370 }
24371
24372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24373         LDKLightningError e_conv;
24374         e_conv.inner = untag_ptr(e);
24375         e_conv.is_owned = ptr_is_owned(e);
24376         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24377         e_conv = LightningError_clone(&e_conv);
24378         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24379         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
24380         return tag_ptr(ret_conv, true);
24381 }
24382
24383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24384         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
24385         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
24386         return ret_conv;
24387 }
24388
24389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24390         if (!ptr_is_owned(_res)) return;
24391         void* _res_ptr = untag_ptr(_res);
24392         CHECK_ACCESS(_res_ptr);
24393         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
24394         FREE(untag_ptr(_res));
24395         CResult_boolLightningErrorZ_free(_res_conv);
24396 }
24397
24398 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
24399         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24400         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
24401         return tag_ptr(ret_conv, true);
24402 }
24403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24404         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
24405         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
24406         return ret_conv;
24407 }
24408
24409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24410         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
24411         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24412         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
24413         return tag_ptr(ret_conv, true);
24414 }
24415
24416 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
24417         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24418         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
24419         return tag_ptr(ret_conv, true);
24420 }
24421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24422         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
24423         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
24424         return ret_conv;
24425 }
24426
24427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24428         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
24429         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24430         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
24431         return tag_ptr(ret_conv, true);
24432 }
24433
24434 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) {
24435         LDKChannelAnnouncement a_conv;
24436         a_conv.inner = untag_ptr(a);
24437         a_conv.is_owned = ptr_is_owned(a);
24438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24439         a_conv = ChannelAnnouncement_clone(&a_conv);
24440         LDKChannelUpdate b_conv;
24441         b_conv.inner = untag_ptr(b);
24442         b_conv.is_owned = ptr_is_owned(b);
24443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24444         b_conv = ChannelUpdate_clone(&b_conv);
24445         LDKChannelUpdate c_conv;
24446         c_conv.inner = untag_ptr(c);
24447         c_conv.is_owned = ptr_is_owned(c);
24448         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24449         c_conv = ChannelUpdate_clone(&c_conv);
24450         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24451         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
24452         return tag_ptr(ret_conv, true);
24453 }
24454
24455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24456         if (!ptr_is_owned(_res)) return;
24457         void* _res_ptr = untag_ptr(_res);
24458         CHECK_ACCESS(_res_ptr);
24459         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
24460         FREE(untag_ptr(_res));
24461         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
24462 }
24463
24464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24465         void* o_ptr = untag_ptr(o);
24466         CHECK_ACCESS(o_ptr);
24467         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
24468         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
24469         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24470         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
24471         int64_t ret_ref = tag_ptr(ret_copy, true);
24472         return ret_ref;
24473 }
24474
24475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
24476         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24477         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
24478         int64_t ret_ref = tag_ptr(ret_copy, true);
24479         return ret_ref;
24480 }
24481
24482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24483         if (!ptr_is_owned(_res)) return;
24484         void* _res_ptr = untag_ptr(_res);
24485         CHECK_ACCESS(_res_ptr);
24486         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
24487         FREE(untag_ptr(_res));
24488         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
24489 }
24490
24491 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
24492         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24493         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
24494         int64_t ret_ref = tag_ptr(ret_copy, true);
24495         return ret_ref;
24496 }
24497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24498         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
24499         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
24500         return ret_conv;
24501 }
24502
24503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24504         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
24505         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24506         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
24507         int64_t ret_ref = tag_ptr(ret_copy, true);
24508         return ret_ref;
24509 }
24510
24511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24512         LDKCVec_MessageSendEventZ _res_constr;
24513         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24514         if (_res_constr.datalen > 0)
24515                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
24516         else
24517                 _res_constr.data = NULL;
24518         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24519         for (size_t s = 0; s < _res_constr.datalen; s++) {
24520                 int64_t _res_conv_18 = _res_vals[s];
24521                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
24522                 CHECK_ACCESS(_res_conv_18_ptr);
24523                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
24524                 FREE(untag_ptr(_res_conv_18));
24525                 _res_constr.data[s] = _res_conv_18_conv;
24526         }
24527         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24528         CVec_MessageSendEventZ_free(_res_constr);
24529 }
24530
24531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24532         LDKChannelUpdateInfo o_conv;
24533         o_conv.inner = untag_ptr(o);
24534         o_conv.is_owned = ptr_is_owned(o);
24535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24536         o_conv = ChannelUpdateInfo_clone(&o_conv);
24537         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24538         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
24539         return tag_ptr(ret_conv, true);
24540 }
24541
24542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24543         void* e_ptr = untag_ptr(e);
24544         CHECK_ACCESS(e_ptr);
24545         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24546         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24547         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24548         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
24549         return tag_ptr(ret_conv, true);
24550 }
24551
24552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24553         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
24554         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
24555         return ret_conv;
24556 }
24557
24558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24559         if (!ptr_is_owned(_res)) return;
24560         void* _res_ptr = untag_ptr(_res);
24561         CHECK_ACCESS(_res_ptr);
24562         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
24563         FREE(untag_ptr(_res));
24564         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
24565 }
24566
24567 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
24568         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24569         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
24570         return tag_ptr(ret_conv, true);
24571 }
24572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24573         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
24574         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
24575         return ret_conv;
24576 }
24577
24578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24579         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
24580         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24581         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
24582         return tag_ptr(ret_conv, true);
24583 }
24584
24585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24586         LDKChannelInfo o_conv;
24587         o_conv.inner = untag_ptr(o);
24588         o_conv.is_owned = ptr_is_owned(o);
24589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24590         o_conv = ChannelInfo_clone(&o_conv);
24591         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24592         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
24593         return tag_ptr(ret_conv, true);
24594 }
24595
24596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24597         void* e_ptr = untag_ptr(e);
24598         CHECK_ACCESS(e_ptr);
24599         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24600         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24601         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24602         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
24603         return tag_ptr(ret_conv, true);
24604 }
24605
24606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24607         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
24608         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
24609         return ret_conv;
24610 }
24611
24612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24613         if (!ptr_is_owned(_res)) return;
24614         void* _res_ptr = untag_ptr(_res);
24615         CHECK_ACCESS(_res_ptr);
24616         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
24617         FREE(untag_ptr(_res));
24618         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
24619 }
24620
24621 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
24622         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24623         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
24624         return tag_ptr(ret_conv, true);
24625 }
24626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24627         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
24628         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
24629         return ret_conv;
24630 }
24631
24632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24633         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
24634         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24635         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
24636         return tag_ptr(ret_conv, true);
24637 }
24638
24639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24640         LDKRoutingFees o_conv;
24641         o_conv.inner = untag_ptr(o);
24642         o_conv.is_owned = ptr_is_owned(o);
24643         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24644         o_conv = RoutingFees_clone(&o_conv);
24645         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24646         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
24647         return tag_ptr(ret_conv, true);
24648 }
24649
24650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24651         void* e_ptr = untag_ptr(e);
24652         CHECK_ACCESS(e_ptr);
24653         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24654         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24655         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24656         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
24657         return tag_ptr(ret_conv, true);
24658 }
24659
24660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24661         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
24662         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
24663         return ret_conv;
24664 }
24665
24666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24667         if (!ptr_is_owned(_res)) return;
24668         void* _res_ptr = untag_ptr(_res);
24669         CHECK_ACCESS(_res_ptr);
24670         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
24671         FREE(untag_ptr(_res));
24672         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
24673 }
24674
24675 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
24676         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24677         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
24678         return tag_ptr(ret_conv, true);
24679 }
24680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24681         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
24682         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
24683         return ret_conv;
24684 }
24685
24686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24687         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
24688         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24689         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
24690         return tag_ptr(ret_conv, true);
24691 }
24692
24693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24694         LDKCVec_SocketAddressZ _res_constr;
24695         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24696         if (_res_constr.datalen > 0)
24697                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24698         else
24699                 _res_constr.data = NULL;
24700         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24701         for (size_t p = 0; p < _res_constr.datalen; p++) {
24702                 int64_t _res_conv_15 = _res_vals[p];
24703                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
24704                 CHECK_ACCESS(_res_conv_15_ptr);
24705                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
24706                 FREE(untag_ptr(_res_conv_15));
24707                 _res_constr.data[p] = _res_conv_15_conv;
24708         }
24709         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24710         CVec_SocketAddressZ_free(_res_constr);
24711 }
24712
24713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24714         LDKNodeAnnouncementInfo o_conv;
24715         o_conv.inner = untag_ptr(o);
24716         o_conv.is_owned = ptr_is_owned(o);
24717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24718         o_conv = NodeAnnouncementInfo_clone(&o_conv);
24719         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24720         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
24721         return tag_ptr(ret_conv, true);
24722 }
24723
24724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24725         void* e_ptr = untag_ptr(e);
24726         CHECK_ACCESS(e_ptr);
24727         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24728         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24729         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24730         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
24731         return tag_ptr(ret_conv, true);
24732 }
24733
24734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24735         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
24736         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
24737         return ret_conv;
24738 }
24739
24740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24741         if (!ptr_is_owned(_res)) return;
24742         void* _res_ptr = untag_ptr(_res);
24743         CHECK_ACCESS(_res_ptr);
24744         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
24745         FREE(untag_ptr(_res));
24746         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
24747 }
24748
24749 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
24750         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24751         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
24752         return tag_ptr(ret_conv, true);
24753 }
24754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24755         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
24756         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
24757         return ret_conv;
24758 }
24759
24760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24761         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
24762         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24763         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
24764         return tag_ptr(ret_conv, true);
24765 }
24766
24767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24768         LDKNodeAlias o_conv;
24769         o_conv.inner = untag_ptr(o);
24770         o_conv.is_owned = ptr_is_owned(o);
24771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24772         o_conv = NodeAlias_clone(&o_conv);
24773         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24774         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
24775         return tag_ptr(ret_conv, true);
24776 }
24777
24778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24779         void* e_ptr = untag_ptr(e);
24780         CHECK_ACCESS(e_ptr);
24781         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24782         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24783         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24784         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
24785         return tag_ptr(ret_conv, true);
24786 }
24787
24788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24789         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
24790         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
24791         return ret_conv;
24792 }
24793
24794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24795         if (!ptr_is_owned(_res)) return;
24796         void* _res_ptr = untag_ptr(_res);
24797         CHECK_ACCESS(_res_ptr);
24798         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
24799         FREE(untag_ptr(_res));
24800         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
24801 }
24802
24803 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
24804         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24805         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
24806         return tag_ptr(ret_conv, true);
24807 }
24808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24809         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
24810         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
24811         return ret_conv;
24812 }
24813
24814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24815         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
24816         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24817         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
24818         return tag_ptr(ret_conv, true);
24819 }
24820
24821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24822         LDKNodeInfo o_conv;
24823         o_conv.inner = untag_ptr(o);
24824         o_conv.is_owned = ptr_is_owned(o);
24825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24826         o_conv = NodeInfo_clone(&o_conv);
24827         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24828         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
24829         return tag_ptr(ret_conv, true);
24830 }
24831
24832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24833         void* e_ptr = untag_ptr(e);
24834         CHECK_ACCESS(e_ptr);
24835         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24836         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24837         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24838         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
24839         return tag_ptr(ret_conv, true);
24840 }
24841
24842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24843         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
24844         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
24845         return ret_conv;
24846 }
24847
24848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24849         if (!ptr_is_owned(_res)) return;
24850         void* _res_ptr = untag_ptr(_res);
24851         CHECK_ACCESS(_res_ptr);
24852         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
24853         FREE(untag_ptr(_res));
24854         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
24855 }
24856
24857 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
24858         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24859         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
24860         return tag_ptr(ret_conv, true);
24861 }
24862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24863         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
24864         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
24865         return ret_conv;
24866 }
24867
24868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24869         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
24870         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24871         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
24872         return tag_ptr(ret_conv, true);
24873 }
24874
24875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24876         LDKNetworkGraph o_conv;
24877         o_conv.inner = untag_ptr(o);
24878         o_conv.is_owned = ptr_is_owned(o);
24879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24880         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
24881         
24882         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24883         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
24884         return tag_ptr(ret_conv, true);
24885 }
24886
24887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24888         void* e_ptr = untag_ptr(e);
24889         CHECK_ACCESS(e_ptr);
24890         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24891         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24892         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24893         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
24894         return tag_ptr(ret_conv, true);
24895 }
24896
24897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24898         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
24899         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
24900         return ret_conv;
24901 }
24902
24903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24904         if (!ptr_is_owned(_res)) return;
24905         void* _res_ptr = untag_ptr(_res);
24906         CHECK_ACCESS(_res_ptr);
24907         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
24908         FREE(untag_ptr(_res));
24909         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
24910 }
24911
24912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
24913         LDKCVec_SocketAddressZ o_constr;
24914         o_constr.datalen = (*env)->GetArrayLength(env, o);
24915         if (o_constr.datalen > 0)
24916                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24917         else
24918                 o_constr.data = NULL;
24919         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
24920         for (size_t p = 0; p < o_constr.datalen; p++) {
24921                 int64_t o_conv_15 = o_vals[p];
24922                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
24923                 CHECK_ACCESS(o_conv_15_ptr);
24924                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
24925                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
24926                 o_constr.data[p] = o_conv_15_conv;
24927         }
24928         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
24929         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24930         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
24931         int64_t ret_ref = tag_ptr(ret_copy, true);
24932         return ret_ref;
24933 }
24934
24935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
24936         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24937         *ret_copy = COption_CVec_SocketAddressZZ_none();
24938         int64_t ret_ref = tag_ptr(ret_copy, true);
24939         return ret_ref;
24940 }
24941
24942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24943         if (!ptr_is_owned(_res)) return;
24944         void* _res_ptr = untag_ptr(_res);
24945         CHECK_ACCESS(_res_ptr);
24946         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
24947         FREE(untag_ptr(_res));
24948         COption_CVec_SocketAddressZZ_free(_res_conv);
24949 }
24950
24951 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
24952         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24953         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
24954         int64_t ret_ref = tag_ptr(ret_copy, true);
24955         return ret_ref;
24956 }
24957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24958         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
24959         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
24960         return ret_conv;
24961 }
24962
24963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24964         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
24965         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24966         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
24967         int64_t ret_ref = tag_ptr(ret_copy, true);
24968         return ret_ref;
24969 }
24970
24971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24972         LDKChannelDerivationParameters o_conv;
24973         o_conv.inner = untag_ptr(o);
24974         o_conv.is_owned = ptr_is_owned(o);
24975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24976         o_conv = ChannelDerivationParameters_clone(&o_conv);
24977         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
24978         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
24979         return tag_ptr(ret_conv, true);
24980 }
24981
24982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24983         void* e_ptr = untag_ptr(e);
24984         CHECK_ACCESS(e_ptr);
24985         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24986         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24987         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
24988         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
24989         return tag_ptr(ret_conv, true);
24990 }
24991
24992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24993         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
24994         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
24995         return ret_conv;
24996 }
24997
24998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24999         if (!ptr_is_owned(_res)) return;
25000         void* _res_ptr = untag_ptr(_res);
25001         CHECK_ACCESS(_res_ptr);
25002         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
25003         FREE(untag_ptr(_res));
25004         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
25005 }
25006
25007 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
25008         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25009         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
25010         return tag_ptr(ret_conv, true);
25011 }
25012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25013         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
25014         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
25015         return ret_conv;
25016 }
25017
25018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25019         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
25020         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25021         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
25022         return tag_ptr(ret_conv, true);
25023 }
25024
25025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25026         LDKHTLCDescriptor o_conv;
25027         o_conv.inner = untag_ptr(o);
25028         o_conv.is_owned = ptr_is_owned(o);
25029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25030         o_conv = HTLCDescriptor_clone(&o_conv);
25031         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25032         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
25033         return tag_ptr(ret_conv, true);
25034 }
25035
25036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25037         void* e_ptr = untag_ptr(e);
25038         CHECK_ACCESS(e_ptr);
25039         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25040         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25041         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25042         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
25043         return tag_ptr(ret_conv, true);
25044 }
25045
25046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25047         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
25048         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
25049         return ret_conv;
25050 }
25051
25052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25053         if (!ptr_is_owned(_res)) return;
25054         void* _res_ptr = untag_ptr(_res);
25055         CHECK_ACCESS(_res_ptr);
25056         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
25057         FREE(untag_ptr(_res));
25058         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
25059 }
25060
25061 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25062         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25063         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
25064         return tag_ptr(ret_conv, true);
25065 }
25066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25067         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
25068         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25069         return ret_conv;
25070 }
25071
25072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25073         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
25074         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25075         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
25076         return tag_ptr(ret_conv, true);
25077 }
25078
25079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25080         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
25081         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25082         if (_res_constr.datalen > 0)
25083                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
25084         else
25085                 _res_constr.data = NULL;
25086         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25087         for (size_t y = 0; y < _res_constr.datalen; y++) {
25088                 int64_t _res_conv_24 = _res_vals[y];
25089                 LDKHTLCOutputInCommitment _res_conv_24_conv;
25090                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
25091                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
25092                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
25093                 _res_constr.data[y] = _res_conv_24_conv;
25094         }
25095         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25096         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
25097 }
25098
25099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25100         LDKCVec_HTLCDescriptorZ _res_constr;
25101         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25102         if (_res_constr.datalen > 0)
25103                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
25104         else
25105                 _res_constr.data = NULL;
25106         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25107         for (size_t q = 0; q < _res_constr.datalen; q++) {
25108                 int64_t _res_conv_16 = _res_vals[q];
25109                 LDKHTLCDescriptor _res_conv_16_conv;
25110                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25111                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25112                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25113                 _res_constr.data[q] = _res_conv_16_conv;
25114         }
25115         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25116         CVec_HTLCDescriptorZ_free(_res_constr);
25117 }
25118
25119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25120         LDKCVec_UtxoZ _res_constr;
25121         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25122         if (_res_constr.datalen > 0)
25123                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25124         else
25125                 _res_constr.data = NULL;
25126         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25127         for (size_t g = 0; g < _res_constr.datalen; g++) {
25128                 int64_t _res_conv_6 = _res_vals[g];
25129                 LDKUtxo _res_conv_6_conv;
25130                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
25131                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
25132                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
25133                 _res_constr.data[g] = _res_conv_6_conv;
25134         }
25135         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25136         CVec_UtxoZ_free(_res_constr);
25137 }
25138
25139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25140         void* o_ptr = untag_ptr(o);
25141         CHECK_ACCESS(o_ptr);
25142         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
25143         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
25144         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25145         *ret_copy = COption_TxOutZ_some(o_conv);
25146         int64_t ret_ref = tag_ptr(ret_copy, true);
25147         return ret_ref;
25148 }
25149
25150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
25151         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25152         *ret_copy = COption_TxOutZ_none();
25153         int64_t ret_ref = tag_ptr(ret_copy, true);
25154         return ret_ref;
25155 }
25156
25157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25158         if (!ptr_is_owned(_res)) return;
25159         void* _res_ptr = untag_ptr(_res);
25160         CHECK_ACCESS(_res_ptr);
25161         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
25162         FREE(untag_ptr(_res));
25163         COption_TxOutZ_free(_res_conv);
25164 }
25165
25166 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
25167         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25168         *ret_copy = COption_TxOutZ_clone(arg);
25169         int64_t ret_ref = tag_ptr(ret_copy, true);
25170         return ret_ref;
25171 }
25172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25173         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
25174         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
25175         return ret_conv;
25176 }
25177
25178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25179         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
25180         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25181         *ret_copy = COption_TxOutZ_clone(orig_conv);
25182         int64_t ret_ref = tag_ptr(ret_copy, true);
25183         return ret_ref;
25184 }
25185
25186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25187         LDKCVec_InputZ _res_constr;
25188         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25189         if (_res_constr.datalen > 0)
25190                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
25191         else
25192                 _res_constr.data = NULL;
25193         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25194         for (size_t h = 0; h < _res_constr.datalen; h++) {
25195                 int64_t _res_conv_7 = _res_vals[h];
25196                 LDKInput _res_conv_7_conv;
25197                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
25198                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
25199                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
25200                 _res_constr.data[h] = _res_conv_7_conv;
25201         }
25202         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25203         CVec_InputZ_free(_res_constr);
25204 }
25205
25206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25207         LDKCoinSelection o_conv;
25208         o_conv.inner = untag_ptr(o);
25209         o_conv.is_owned = ptr_is_owned(o);
25210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25211         o_conv = CoinSelection_clone(&o_conv);
25212         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25213         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
25214         return tag_ptr(ret_conv, true);
25215 }
25216
25217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
25218         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25219         *ret_conv = CResult_CoinSelectionNoneZ_err();
25220         return tag_ptr(ret_conv, true);
25221 }
25222
25223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25224         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
25225         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
25226         return ret_conv;
25227 }
25228
25229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25230         if (!ptr_is_owned(_res)) return;
25231         void* _res_ptr = untag_ptr(_res);
25232         CHECK_ACCESS(_res_ptr);
25233         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
25234         FREE(untag_ptr(_res));
25235         CResult_CoinSelectionNoneZ_free(_res_conv);
25236 }
25237
25238 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
25239         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25240         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
25241         return tag_ptr(ret_conv, true);
25242 }
25243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25244         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
25245         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
25246         return ret_conv;
25247 }
25248
25249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25250         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
25251         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25252         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
25253         return tag_ptr(ret_conv, true);
25254 }
25255
25256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
25257         LDKCVec_UtxoZ o_constr;
25258         o_constr.datalen = (*env)->GetArrayLength(env, o);
25259         if (o_constr.datalen > 0)
25260                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25261         else
25262                 o_constr.data = NULL;
25263         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25264         for (size_t g = 0; g < o_constr.datalen; g++) {
25265                 int64_t o_conv_6 = o_vals[g];
25266                 LDKUtxo o_conv_6_conv;
25267                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
25268                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
25269                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
25270                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
25271                 o_constr.data[g] = o_conv_6_conv;
25272         }
25273         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25274         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25275         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
25276         return tag_ptr(ret_conv, true);
25277 }
25278
25279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
25280         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25281         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
25282         return tag_ptr(ret_conv, true);
25283 }
25284
25285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25286         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
25287         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
25288         return ret_conv;
25289 }
25290
25291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25292         if (!ptr_is_owned(_res)) return;
25293         void* _res_ptr = untag_ptr(_res);
25294         CHECK_ACCESS(_res_ptr);
25295         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
25296         FREE(untag_ptr(_res));
25297         CResult_CVec_UtxoZNoneZ_free(_res_conv);
25298 }
25299
25300 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
25301         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25302         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
25303         return tag_ptr(ret_conv, true);
25304 }
25305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25306         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
25307         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
25308         return ret_conv;
25309 }
25310
25311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25312         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
25313         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25314         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
25315         return tag_ptr(ret_conv, true);
25316 }
25317
25318 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
25319         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25320         *ret_conv = C2Tuple_u64u16Z_clone(arg);
25321         return tag_ptr(ret_conv, true);
25322 }
25323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25324         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
25325         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
25326         return ret_conv;
25327 }
25328
25329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25330         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
25331         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25332         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
25333         return tag_ptr(ret_conv, true);
25334 }
25335
25336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
25337         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25338         *ret_conv = C2Tuple_u64u16Z_new(a, b);
25339         return tag_ptr(ret_conv, true);
25340 }
25341
25342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25343         if (!ptr_is_owned(_res)) return;
25344         void* _res_ptr = untag_ptr(_res);
25345         CHECK_ACCESS(_res_ptr);
25346         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
25347         FREE(untag_ptr(_res));
25348         C2Tuple_u64u16Z_free(_res_conv);
25349 }
25350
25351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25352         void* o_ptr = untag_ptr(o);
25353         CHECK_ACCESS(o_ptr);
25354         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
25355         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
25356         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25357         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
25358         int64_t ret_ref = tag_ptr(ret_copy, true);
25359         return ret_ref;
25360 }
25361
25362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
25363         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25364         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
25365         int64_t ret_ref = tag_ptr(ret_copy, true);
25366         return ret_ref;
25367 }
25368
25369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25370         if (!ptr_is_owned(_res)) return;
25371         void* _res_ptr = untag_ptr(_res);
25372         CHECK_ACCESS(_res_ptr);
25373         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
25374         FREE(untag_ptr(_res));
25375         COption_C2Tuple_u64u16ZZ_free(_res_conv);
25376 }
25377
25378 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
25379         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25380         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
25381         int64_t ret_ref = tag_ptr(ret_copy, true);
25382         return ret_ref;
25383 }
25384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25385         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
25386         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
25387         return ret_conv;
25388 }
25389
25390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25391         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
25392         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25393         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
25394         int64_t ret_ref = tag_ptr(ret_copy, true);
25395         return ret_ref;
25396 }
25397
25398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
25399         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
25400         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25401         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
25402         int64_t ret_ref = tag_ptr(ret_copy, true);
25403         return ret_ref;
25404 }
25405
25406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
25407         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25408         *ret_copy = COption_ChannelShutdownStateZ_none();
25409         int64_t ret_ref = tag_ptr(ret_copy, true);
25410         return ret_ref;
25411 }
25412
25413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25414         if (!ptr_is_owned(_res)) return;
25415         void* _res_ptr = untag_ptr(_res);
25416         CHECK_ACCESS(_res_ptr);
25417         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
25418         FREE(untag_ptr(_res));
25419         COption_ChannelShutdownStateZ_free(_res_conv);
25420 }
25421
25422 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
25423         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25424         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
25425         int64_t ret_ref = tag_ptr(ret_copy, true);
25426         return ret_ref;
25427 }
25428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25429         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
25430         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
25431         return ret_conv;
25432 }
25433
25434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25435         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
25436         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25437         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
25438         int64_t ret_ref = tag_ptr(ret_copy, true);
25439         return ret_ref;
25440 }
25441
25442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25443         LDKThirtyTwoBytes o_ref;
25444         CHECK((*env)->GetArrayLength(env, o) == 32);
25445         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25446         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25447         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
25448         return tag_ptr(ret_conv, true);
25449 }
25450
25451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25452         void* e_ptr = untag_ptr(e);
25453         CHECK_ACCESS(e_ptr);
25454         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
25455         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
25456         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25457         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
25458         return tag_ptr(ret_conv, true);
25459 }
25460
25461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25462         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
25463         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
25464         return ret_conv;
25465 }
25466
25467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25468         if (!ptr_is_owned(_res)) return;
25469         void* _res_ptr = untag_ptr(_res);
25470         CHECK_ACCESS(_res_ptr);
25471         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
25472         FREE(untag_ptr(_res));
25473         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
25474 }
25475
25476 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
25477         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25478         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
25479         return tag_ptr(ret_conv, true);
25480 }
25481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25482         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
25483         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
25484         return ret_conv;
25485 }
25486
25487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25488         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
25489         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25490         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
25491         return tag_ptr(ret_conv, true);
25492 }
25493
25494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25495         LDKCVec_RecentPaymentDetailsZ _res_constr;
25496         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25497         if (_res_constr.datalen > 0)
25498                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
25499         else
25500                 _res_constr.data = NULL;
25501         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25502         for (size_t w = 0; w < _res_constr.datalen; w++) {
25503                 int64_t _res_conv_22 = _res_vals[w];
25504                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
25505                 CHECK_ACCESS(_res_conv_22_ptr);
25506                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
25507                 FREE(untag_ptr(_res_conv_22));
25508                 _res_constr.data[w] = _res_conv_22_conv;
25509         }
25510         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25511         CVec_RecentPaymentDetailsZ_free(_res_constr);
25512 }
25513
25514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25515         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25516         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
25517         return tag_ptr(ret_conv, true);
25518 }
25519
25520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25521         void* e_ptr = untag_ptr(e);
25522         CHECK_ACCESS(e_ptr);
25523         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25524         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25525         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25526         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
25527         return tag_ptr(ret_conv, true);
25528 }
25529
25530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25531         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
25532         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
25533         return ret_conv;
25534 }
25535
25536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25537         if (!ptr_is_owned(_res)) return;
25538         void* _res_ptr = untag_ptr(_res);
25539         CHECK_ACCESS(_res_ptr);
25540         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
25541         FREE(untag_ptr(_res));
25542         CResult_NonePaymentSendFailureZ_free(_res_conv);
25543 }
25544
25545 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
25546         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25547         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
25548         return tag_ptr(ret_conv, true);
25549 }
25550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25551         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
25552         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
25553         return ret_conv;
25554 }
25555
25556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25557         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
25558         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25559         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
25560         return tag_ptr(ret_conv, true);
25561 }
25562
25563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25564         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25565         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
25566         return tag_ptr(ret_conv, true);
25567 }
25568
25569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25570         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25571         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25572         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25577         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
25578         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
25579         return ret_conv;
25580 }
25581
25582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25583         if (!ptr_is_owned(_res)) return;
25584         void* _res_ptr = untag_ptr(_res);
25585         CHECK_ACCESS(_res_ptr);
25586         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
25587         FREE(untag_ptr(_res));
25588         CResult_NoneRetryableSendFailureZ_free(_res_conv);
25589 }
25590
25591 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
25592         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25593         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
25594         return tag_ptr(ret_conv, true);
25595 }
25596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25597         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
25598         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
25599         return ret_conv;
25600 }
25601
25602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25603         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
25604         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25605         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
25606         return tag_ptr(ret_conv, true);
25607 }
25608
25609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25610         LDKThirtyTwoBytes o_ref;
25611         CHECK((*env)->GetArrayLength(env, o) == 32);
25612         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25613         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25614         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
25615         return tag_ptr(ret_conv, true);
25616 }
25617
25618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25619         void* e_ptr = untag_ptr(e);
25620         CHECK_ACCESS(e_ptr);
25621         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25622         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25623         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25624         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
25625         return tag_ptr(ret_conv, true);
25626 }
25627
25628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25629         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
25630         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
25631         return ret_conv;
25632 }
25633
25634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25635         if (!ptr_is_owned(_res)) return;
25636         void* _res_ptr = untag_ptr(_res);
25637         CHECK_ACCESS(_res_ptr);
25638         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
25639         FREE(untag_ptr(_res));
25640         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
25641 }
25642
25643 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
25644         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25645         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
25646         return tag_ptr(ret_conv, true);
25647 }
25648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25649         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
25650         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
25651         return ret_conv;
25652 }
25653
25654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25655         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
25656         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25657         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
25658         return tag_ptr(ret_conv, true);
25659 }
25660
25661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25662         LDKThirtyTwoBytes o_ref;
25663         CHECK((*env)->GetArrayLength(env, o) == 32);
25664         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25665         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25666         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
25667         return tag_ptr(ret_conv, true);
25668 }
25669
25670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25671         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25672         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25673         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
25674         return tag_ptr(ret_conv, true);
25675 }
25676
25677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25678         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
25679         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
25680         return ret_conv;
25681 }
25682
25683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25684         if (!ptr_is_owned(_res)) return;
25685         void* _res_ptr = untag_ptr(_res);
25686         CHECK_ACCESS(_res_ptr);
25687         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
25688         FREE(untag_ptr(_res));
25689         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
25690 }
25691
25692 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
25693         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25694         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
25695         return tag_ptr(ret_conv, true);
25696 }
25697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25698         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
25699         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
25700         return ret_conv;
25701 }
25702
25703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25704         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
25705         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25706         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
25707         return tag_ptr(ret_conv, true);
25708 }
25709
25710 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
25711         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
25712         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
25713         return tag_ptr(ret_conv, true);
25714 }
25715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25716         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
25717         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
25718         return ret_conv;
25719 }
25720
25721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25722         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
25723         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
25724         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
25725         return tag_ptr(ret_conv, true);
25726 }
25727
25728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
25729         LDKThirtyTwoBytes a_ref;
25730         CHECK((*env)->GetArrayLength(env, a) == 32);
25731         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25732         LDKThirtyTwoBytes b_ref;
25733         CHECK((*env)->GetArrayLength(env, b) == 32);
25734         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
25735         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
25736         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
25737         return tag_ptr(ret_conv, true);
25738 }
25739
25740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_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         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
25745         FREE(untag_ptr(_res));
25746         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
25747 }
25748
25749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25750         void* o_ptr = untag_ptr(o);
25751         CHECK_ACCESS(o_ptr);
25752         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
25753         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
25754         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25755         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
25756         return tag_ptr(ret_conv, true);
25757 }
25758
25759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25760         void* e_ptr = untag_ptr(e);
25761         CHECK_ACCESS(e_ptr);
25762         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25763         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25764         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25765         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
25766         return tag_ptr(ret_conv, true);
25767 }
25768
25769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25770         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
25771         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
25772         return ret_conv;
25773 }
25774
25775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25776         if (!ptr_is_owned(_res)) return;
25777         void* _res_ptr = untag_ptr(_res);
25778         CHECK_ACCESS(_res_ptr);
25779         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
25780         FREE(untag_ptr(_res));
25781         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
25782 }
25783
25784 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
25785         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25786         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
25787         return tag_ptr(ret_conv, true);
25788 }
25789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25790         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
25791         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
25792         return ret_conv;
25793 }
25794
25795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25796         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
25797         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25798         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
25799         return tag_ptr(ret_conv, true);
25800 }
25801
25802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25803         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
25804         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25805         if (_res_constr.datalen > 0)
25806                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
25807         else
25808                 _res_constr.data = NULL;
25809         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25810         for (size_t o = 0; o < _res_constr.datalen; o++) {
25811                 int64_t _res_conv_40 = _res_vals[o];
25812                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
25813                 CHECK_ACCESS(_res_conv_40_ptr);
25814                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
25815                 FREE(untag_ptr(_res_conv_40));
25816                 _res_constr.data[o] = _res_conv_40_conv;
25817         }
25818         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25819         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
25820 }
25821
25822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
25823         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
25824         o_constr.datalen = (*env)->GetArrayLength(env, o);
25825         if (o_constr.datalen > 0)
25826                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
25827         else
25828                 o_constr.data = NULL;
25829         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25830         for (size_t o = 0; o < o_constr.datalen; o++) {
25831                 int64_t o_conv_40 = o_vals[o];
25832                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
25833                 CHECK_ACCESS(o_conv_40_ptr);
25834                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
25835                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
25836                 o_constr.data[o] = o_conv_40_conv;
25837         }
25838         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25839         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25840         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
25841         return tag_ptr(ret_conv, true);
25842 }
25843
25844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25845         void* e_ptr = untag_ptr(e);
25846         CHECK_ACCESS(e_ptr);
25847         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
25848         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
25849         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25850         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
25851         return tag_ptr(ret_conv, true);
25852 }
25853
25854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25855         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
25856         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
25857         return ret_conv;
25858 }
25859
25860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25861         if (!ptr_is_owned(_res)) return;
25862         void* _res_ptr = untag_ptr(_res);
25863         CHECK_ACCESS(_res_ptr);
25864         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
25865         FREE(untag_ptr(_res));
25866         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
25867 }
25868
25869 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
25870         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25871         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
25872         return tag_ptr(ret_conv, true);
25873 }
25874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25875         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
25876         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
25877         return ret_conv;
25878 }
25879
25880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25881         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
25882         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25883         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
25884         return tag_ptr(ret_conv, true);
25885 }
25886
25887 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
25888         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
25889         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
25890         return tag_ptr(ret_conv, true);
25891 }
25892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25893         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
25894         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
25895         return ret_conv;
25896 }
25897
25898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25899         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
25900         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
25901         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
25902         return tag_ptr(ret_conv, true);
25903 }
25904
25905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
25906         LDKThirtyTwoBytes a_ref;
25907         CHECK((*env)->GetArrayLength(env, a) == 32);
25908         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25909         LDKPublicKey b_ref;
25910         CHECK((*env)->GetArrayLength(env, b) == 33);
25911         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
25912         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
25913         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
25914         return tag_ptr(ret_conv, true);
25915 }
25916
25917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25918         if (!ptr_is_owned(_res)) return;
25919         void* _res_ptr = untag_ptr(_res);
25920         CHECK_ACCESS(_res_ptr);
25921         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
25922         FREE(untag_ptr(_res));
25923         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
25924 }
25925
25926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25927         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
25928         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25929         if (_res_constr.datalen > 0)
25930                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
25931         else
25932                 _res_constr.data = NULL;
25933         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25934         for (size_t j = 0; j < _res_constr.datalen; j++) {
25935                 int64_t _res_conv_35 = _res_vals[j];
25936                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
25937                 CHECK_ACCESS(_res_conv_35_ptr);
25938                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
25939                 FREE(untag_ptr(_res_conv_35));
25940                 _res_constr.data[j] = _res_conv_35_conv;
25941         }
25942         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25943         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
25944 }
25945
25946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25947         void* o_ptr = untag_ptr(o);
25948         CHECK_ACCESS(o_ptr);
25949         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
25950         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
25951         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25952         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
25953         return tag_ptr(ret_conv, true);
25954 }
25955
25956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
25957         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25958         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
25959         return tag_ptr(ret_conv, true);
25960 }
25961
25962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25963         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
25964         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
25965         return ret_conv;
25966 }
25967
25968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25969         if (!ptr_is_owned(_res)) return;
25970         void* _res_ptr = untag_ptr(_res);
25971         CHECK_ACCESS(_res_ptr);
25972         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
25973         FREE(untag_ptr(_res));
25974         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
25975 }
25976
25977 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
25978         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25979         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
25980         return tag_ptr(ret_conv, true);
25981 }
25982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25983         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
25984         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
25985         return ret_conv;
25986 }
25987
25988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25989         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
25990         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25991         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
25992         return tag_ptr(ret_conv, true);
25993 }
25994
25995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25996         LDKCounterpartyForwardingInfo o_conv;
25997         o_conv.inner = untag_ptr(o);
25998         o_conv.is_owned = ptr_is_owned(o);
25999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26000         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
26001         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26002         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
26003         return tag_ptr(ret_conv, true);
26004 }
26005
26006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26007         void* e_ptr = untag_ptr(e);
26008         CHECK_ACCESS(e_ptr);
26009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26011         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26012         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
26013         return tag_ptr(ret_conv, true);
26014 }
26015
26016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26017         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
26018         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
26019         return ret_conv;
26020 }
26021
26022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26023         if (!ptr_is_owned(_res)) return;
26024         void* _res_ptr = untag_ptr(_res);
26025         CHECK_ACCESS(_res_ptr);
26026         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
26027         FREE(untag_ptr(_res));
26028         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
26029 }
26030
26031 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
26032         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26033         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
26034         return tag_ptr(ret_conv, true);
26035 }
26036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26037         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
26038         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
26039         return ret_conv;
26040 }
26041
26042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26043         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
26044         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26045         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
26046         return tag_ptr(ret_conv, true);
26047 }
26048
26049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26050         LDKChannelCounterparty o_conv;
26051         o_conv.inner = untag_ptr(o);
26052         o_conv.is_owned = ptr_is_owned(o);
26053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26054         o_conv = ChannelCounterparty_clone(&o_conv);
26055         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26056         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
26057         return tag_ptr(ret_conv, true);
26058 }
26059
26060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26061         void* e_ptr = untag_ptr(e);
26062         CHECK_ACCESS(e_ptr);
26063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26065         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26066         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
26067         return tag_ptr(ret_conv, true);
26068 }
26069
26070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26071         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
26072         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
26073         return ret_conv;
26074 }
26075
26076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26077         if (!ptr_is_owned(_res)) return;
26078         void* _res_ptr = untag_ptr(_res);
26079         CHECK_ACCESS(_res_ptr);
26080         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
26081         FREE(untag_ptr(_res));
26082         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
26083 }
26084
26085 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
26086         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26087         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
26088         return tag_ptr(ret_conv, true);
26089 }
26090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26091         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
26092         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
26093         return ret_conv;
26094 }
26095
26096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26097         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
26098         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26099         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
26100         return tag_ptr(ret_conv, true);
26101 }
26102
26103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26104         LDKChannelDetails o_conv;
26105         o_conv.inner = untag_ptr(o);
26106         o_conv.is_owned = ptr_is_owned(o);
26107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26108         o_conv = ChannelDetails_clone(&o_conv);
26109         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26110         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
26111         return tag_ptr(ret_conv, true);
26112 }
26113
26114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26115         void* e_ptr = untag_ptr(e);
26116         CHECK_ACCESS(e_ptr);
26117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26119         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26120         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
26121         return tag_ptr(ret_conv, true);
26122 }
26123
26124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26125         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
26126         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
26127         return ret_conv;
26128 }
26129
26130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26131         if (!ptr_is_owned(_res)) return;
26132         void* _res_ptr = untag_ptr(_res);
26133         CHECK_ACCESS(_res_ptr);
26134         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
26135         FREE(untag_ptr(_res));
26136         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
26137 }
26138
26139 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
26140         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26141         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
26142         return tag_ptr(ret_conv, true);
26143 }
26144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26145         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
26146         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
26147         return ret_conv;
26148 }
26149
26150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26151         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
26152         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26153         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
26154         return tag_ptr(ret_conv, true);
26155 }
26156
26157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26158         LDKPhantomRouteHints o_conv;
26159         o_conv.inner = untag_ptr(o);
26160         o_conv.is_owned = ptr_is_owned(o);
26161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26162         o_conv = PhantomRouteHints_clone(&o_conv);
26163         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26164         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
26165         return tag_ptr(ret_conv, true);
26166 }
26167
26168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26169         void* e_ptr = untag_ptr(e);
26170         CHECK_ACCESS(e_ptr);
26171         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26172         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26173         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26174         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
26175         return tag_ptr(ret_conv, true);
26176 }
26177
26178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26179         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
26180         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
26181         return ret_conv;
26182 }
26183
26184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26185         if (!ptr_is_owned(_res)) return;
26186         void* _res_ptr = untag_ptr(_res);
26187         CHECK_ACCESS(_res_ptr);
26188         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
26189         FREE(untag_ptr(_res));
26190         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
26191 }
26192
26193 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
26194         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26195         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
26196         return tag_ptr(ret_conv, true);
26197 }
26198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26199         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
26200         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
26201         return ret_conv;
26202 }
26203
26204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26205         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
26206         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26207         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
26208         return tag_ptr(ret_conv, true);
26209 }
26210
26211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
26212         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
26213         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26214         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
26215         return tag_ptr(ret_conv, true);
26216 }
26217
26218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26219         void* e_ptr = untag_ptr(e);
26220         CHECK_ACCESS(e_ptr);
26221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26223         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26224         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
26225         return tag_ptr(ret_conv, true);
26226 }
26227
26228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26229         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
26230         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
26231         return ret_conv;
26232 }
26233
26234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26235         if (!ptr_is_owned(_res)) return;
26236         void* _res_ptr = untag_ptr(_res);
26237         CHECK_ACCESS(_res_ptr);
26238         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
26239         FREE(untag_ptr(_res));
26240         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
26241 }
26242
26243 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
26244         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26245         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
26246         return tag_ptr(ret_conv, true);
26247 }
26248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26249         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
26250         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
26251         return ret_conv;
26252 }
26253
26254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26255         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
26256         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26257         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
26258         return tag_ptr(ret_conv, true);
26259 }
26260
26261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26262         LDKCVec_ChannelMonitorZ _res_constr;
26263         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26264         if (_res_constr.datalen > 0)
26265                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26266         else
26267                 _res_constr.data = NULL;
26268         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26269         for (size_t q = 0; q < _res_constr.datalen; q++) {
26270                 int64_t _res_conv_16 = _res_vals[q];
26271                 LDKChannelMonitor _res_conv_16_conv;
26272                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26273                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26274                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26275                 _res_constr.data[q] = _res_conv_16_conv;
26276         }
26277         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26278         CVec_ChannelMonitorZ_free(_res_constr);
26279 }
26280
26281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
26282         LDKThirtyTwoBytes a_ref;
26283         CHECK((*env)->GetArrayLength(env, a) == 32);
26284         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26285         LDKChannelManager b_conv;
26286         b_conv.inner = untag_ptr(b);
26287         b_conv.is_owned = ptr_is_owned(b);
26288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26289         // WARNING: we need a move here but no clone is available for LDKChannelManager
26290         
26291         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
26292         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
26293         return tag_ptr(ret_conv, true);
26294 }
26295
26296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26297         if (!ptr_is_owned(_res)) return;
26298         void* _res_ptr = untag_ptr(_res);
26299         CHECK_ACCESS(_res_ptr);
26300         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
26301         FREE(untag_ptr(_res));
26302         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
26303 }
26304
26305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26306         void* o_ptr = untag_ptr(o);
26307         CHECK_ACCESS(o_ptr);
26308         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
26309         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
26310         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26311         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
26312         return tag_ptr(ret_conv, true);
26313 }
26314
26315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26316         void* e_ptr = untag_ptr(e);
26317         CHECK_ACCESS(e_ptr);
26318         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26319         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26320         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26321         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
26322         return tag_ptr(ret_conv, true);
26323 }
26324
26325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26326         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
26327         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
26328         return ret_conv;
26329 }
26330
26331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26332         if (!ptr_is_owned(_res)) return;
26333         void* _res_ptr = untag_ptr(_res);
26334         CHECK_ACCESS(_res_ptr);
26335         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
26336         FREE(untag_ptr(_res));
26337         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
26338 }
26339
26340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26341         void* o_ptr = untag_ptr(o);
26342         CHECK_ACCESS(o_ptr);
26343         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26344         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26345         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26346         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
26347         return tag_ptr(ret_conv, true);
26348 }
26349
26350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26351         void* e_ptr = untag_ptr(e);
26352         CHECK_ACCESS(e_ptr);
26353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26355         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26356         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
26357         return tag_ptr(ret_conv, true);
26358 }
26359
26360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26361         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
26362         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
26363         return ret_conv;
26364 }
26365
26366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26367         if (!ptr_is_owned(_res)) return;
26368         void* _res_ptr = untag_ptr(_res);
26369         CHECK_ACCESS(_res_ptr);
26370         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
26371         FREE(untag_ptr(_res));
26372         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
26373 }
26374
26375 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
26376         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26377         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
26378         return tag_ptr(ret_conv, true);
26379 }
26380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26381         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
26382         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
26383         return ret_conv;
26384 }
26385
26386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26387         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
26388         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26389         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
26390         return tag_ptr(ret_conv, true);
26391 }
26392
26393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26394         LDKChannelConfig o_conv;
26395         o_conv.inner = untag_ptr(o);
26396         o_conv.is_owned = ptr_is_owned(o);
26397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26398         o_conv = ChannelConfig_clone(&o_conv);
26399         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26400         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
26401         return tag_ptr(ret_conv, true);
26402 }
26403
26404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26405         void* e_ptr = untag_ptr(e);
26406         CHECK_ACCESS(e_ptr);
26407         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26408         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26409         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26410         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
26411         return tag_ptr(ret_conv, true);
26412 }
26413
26414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26415         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
26416         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
26417         return ret_conv;
26418 }
26419
26420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26421         if (!ptr_is_owned(_res)) return;
26422         void* _res_ptr = untag_ptr(_res);
26423         CHECK_ACCESS(_res_ptr);
26424         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
26425         FREE(untag_ptr(_res));
26426         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
26427 }
26428
26429 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
26430         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26431         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
26432         return tag_ptr(ret_conv, true);
26433 }
26434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26435         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
26436         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
26437         return ret_conv;
26438 }
26439
26440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26441         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
26442         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26443         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
26444         return tag_ptr(ret_conv, true);
26445 }
26446
26447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26448         void* o_ptr = untag_ptr(o);
26449         CHECK_ACCESS(o_ptr);
26450         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26451         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26452         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26453         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
26454         int64_t ret_ref = tag_ptr(ret_copy, true);
26455         return ret_ref;
26456 }
26457
26458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
26459         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26460         *ret_copy = COption_MaxDustHTLCExposureZ_none();
26461         int64_t ret_ref = tag_ptr(ret_copy, true);
26462         return ret_ref;
26463 }
26464
26465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26466         if (!ptr_is_owned(_res)) return;
26467         void* _res_ptr = untag_ptr(_res);
26468         CHECK_ACCESS(_res_ptr);
26469         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
26470         FREE(untag_ptr(_res));
26471         COption_MaxDustHTLCExposureZ_free(_res_conv);
26472 }
26473
26474 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
26475         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26476         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
26477         int64_t ret_ref = tag_ptr(ret_copy, true);
26478         return ret_ref;
26479 }
26480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26481         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
26482         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
26483         return ret_conv;
26484 }
26485
26486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26487         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
26488         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26489         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
26490         int64_t ret_ref = tag_ptr(ret_copy, true);
26491         return ret_ref;
26492 }
26493
26494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26495         void* o_ptr = untag_ptr(o);
26496         CHECK_ACCESS(o_ptr);
26497         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
26498         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
26499         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26500         *ret_copy = COption_APIErrorZ_some(o_conv);
26501         int64_t ret_ref = tag_ptr(ret_copy, true);
26502         return ret_ref;
26503 }
26504
26505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
26506         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26507         *ret_copy = COption_APIErrorZ_none();
26508         int64_t ret_ref = tag_ptr(ret_copy, true);
26509         return ret_ref;
26510 }
26511
26512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26513         if (!ptr_is_owned(_res)) return;
26514         void* _res_ptr = untag_ptr(_res);
26515         CHECK_ACCESS(_res_ptr);
26516         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
26517         FREE(untag_ptr(_res));
26518         COption_APIErrorZ_free(_res_conv);
26519 }
26520
26521 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
26522         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26523         *ret_copy = COption_APIErrorZ_clone(arg);
26524         int64_t ret_ref = tag_ptr(ret_copy, true);
26525         return ret_ref;
26526 }
26527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26528         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
26529         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
26530         return ret_conv;
26531 }
26532
26533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26534         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
26535         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26536         *ret_copy = COption_APIErrorZ_clone(orig_conv);
26537         int64_t ret_ref = tag_ptr(ret_copy, true);
26538         return ret_ref;
26539 }
26540
26541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26542         void* o_ptr = untag_ptr(o);
26543         CHECK_ACCESS(o_ptr);
26544         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
26545         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
26546         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26547         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
26548         return tag_ptr(ret_conv, true);
26549 }
26550
26551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_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_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26557         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
26558         return tag_ptr(ret_conv, true);
26559 }
26560
26561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26562         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
26563         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
26564         return ret_conv;
26565 }
26566
26567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_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_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
26572         FREE(untag_ptr(_res));
26573         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
26574 }
26575
26576 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
26577         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26578         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
26579         return tag_ptr(ret_conv, true);
26580 }
26581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26582         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
26583         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
26584         return ret_conv;
26585 }
26586
26587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26588         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
26589         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26590         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
26591         return tag_ptr(ret_conv, true);
26592 }
26593
26594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26595         LDKChannelMonitorUpdate o_conv;
26596         o_conv.inner = untag_ptr(o);
26597         o_conv.is_owned = ptr_is_owned(o);
26598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26599         o_conv = ChannelMonitorUpdate_clone(&o_conv);
26600         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26601         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
26602         return tag_ptr(ret_conv, true);
26603 }
26604
26605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26606         void* e_ptr = untag_ptr(e);
26607         CHECK_ACCESS(e_ptr);
26608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26610         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26611         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
26612         return tag_ptr(ret_conv, true);
26613 }
26614
26615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26616         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
26617         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
26618         return ret_conv;
26619 }
26620
26621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26622         if (!ptr_is_owned(_res)) return;
26623         void* _res_ptr = untag_ptr(_res);
26624         CHECK_ACCESS(_res_ptr);
26625         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
26626         FREE(untag_ptr(_res));
26627         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
26628 }
26629
26630 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
26631         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26632         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
26633         return tag_ptr(ret_conv, true);
26634 }
26635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26636         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
26637         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
26638         return ret_conv;
26639 }
26640
26641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26642         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
26643         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26644         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
26645         return tag_ptr(ret_conv, true);
26646 }
26647
26648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26649         void* o_ptr = untag_ptr(o);
26650         CHECK_ACCESS(o_ptr);
26651         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
26652         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
26653         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26654         *ret_copy = COption_MonitorEventZ_some(o_conv);
26655         int64_t ret_ref = tag_ptr(ret_copy, true);
26656         return ret_ref;
26657 }
26658
26659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
26660         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26661         *ret_copy = COption_MonitorEventZ_none();
26662         int64_t ret_ref = tag_ptr(ret_copy, true);
26663         return ret_ref;
26664 }
26665
26666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26667         if (!ptr_is_owned(_res)) return;
26668         void* _res_ptr = untag_ptr(_res);
26669         CHECK_ACCESS(_res_ptr);
26670         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
26671         FREE(untag_ptr(_res));
26672         COption_MonitorEventZ_free(_res_conv);
26673 }
26674
26675 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
26676         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26677         *ret_copy = COption_MonitorEventZ_clone(arg);
26678         int64_t ret_ref = tag_ptr(ret_copy, true);
26679         return ret_ref;
26680 }
26681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26682         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
26683         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
26684         return ret_conv;
26685 }
26686
26687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26688         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
26689         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26690         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
26691         int64_t ret_ref = tag_ptr(ret_copy, true);
26692         return ret_ref;
26693 }
26694
26695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26696         void* o_ptr = untag_ptr(o);
26697         CHECK_ACCESS(o_ptr);
26698         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
26699         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
26700         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26701         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
26702         return tag_ptr(ret_conv, true);
26703 }
26704
26705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26706         void* e_ptr = untag_ptr(e);
26707         CHECK_ACCESS(e_ptr);
26708         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26709         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26710         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26711         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
26712         return tag_ptr(ret_conv, true);
26713 }
26714
26715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26716         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
26717         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
26718         return ret_conv;
26719 }
26720
26721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26722         if (!ptr_is_owned(_res)) return;
26723         void* _res_ptr = untag_ptr(_res);
26724         CHECK_ACCESS(_res_ptr);
26725         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
26726         FREE(untag_ptr(_res));
26727         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
26728 }
26729
26730 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
26731         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26732         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
26733         return tag_ptr(ret_conv, true);
26734 }
26735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26736         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
26737         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
26738         return ret_conv;
26739 }
26740
26741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26742         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
26743         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26744         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
26745         return tag_ptr(ret_conv, true);
26746 }
26747
26748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26749         LDKHTLCUpdate o_conv;
26750         o_conv.inner = untag_ptr(o);
26751         o_conv.is_owned = ptr_is_owned(o);
26752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26753         o_conv = HTLCUpdate_clone(&o_conv);
26754         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26755         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
26756         return tag_ptr(ret_conv, true);
26757 }
26758
26759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26760         void* e_ptr = untag_ptr(e);
26761         CHECK_ACCESS(e_ptr);
26762         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26763         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26764         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26765         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
26766         return tag_ptr(ret_conv, true);
26767 }
26768
26769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26770         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
26771         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
26772         return ret_conv;
26773 }
26774
26775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26776         if (!ptr_is_owned(_res)) return;
26777         void* _res_ptr = untag_ptr(_res);
26778         CHECK_ACCESS(_res_ptr);
26779         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
26780         FREE(untag_ptr(_res));
26781         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
26782 }
26783
26784 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
26785         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26786         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
26787         return tag_ptr(ret_conv, true);
26788 }
26789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26790         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
26791         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
26792         return ret_conv;
26793 }
26794
26795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26796         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
26797         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26798         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
26799         return tag_ptr(ret_conv, true);
26800 }
26801
26802 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
26803         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26804         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
26805         return tag_ptr(ret_conv, true);
26806 }
26807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26808         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
26809         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
26810         return ret_conv;
26811 }
26812
26813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26814         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
26815         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26816         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
26817         return tag_ptr(ret_conv, true);
26818 }
26819
26820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
26821         LDKOutPoint a_conv;
26822         a_conv.inner = untag_ptr(a);
26823         a_conv.is_owned = ptr_is_owned(a);
26824         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26825         a_conv = OutPoint_clone(&a_conv);
26826         LDKCVec_u8Z b_ref;
26827         b_ref.datalen = (*env)->GetArrayLength(env, b);
26828         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26829         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
26830         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26831         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
26832         return tag_ptr(ret_conv, true);
26833 }
26834
26835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26836         if (!ptr_is_owned(_res)) return;
26837         void* _res_ptr = untag_ptr(_res);
26838         CHECK_ACCESS(_res_ptr);
26839         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
26840         FREE(untag_ptr(_res));
26841         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
26842 }
26843
26844 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
26845         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26846         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
26847         return tag_ptr(ret_conv, true);
26848 }
26849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26850         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
26851         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
26852         return ret_conv;
26853 }
26854
26855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26856         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
26857         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26858         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
26859         return tag_ptr(ret_conv, true);
26860 }
26861
26862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
26863         LDKCVec_u8Z b_ref;
26864         b_ref.datalen = (*env)->GetArrayLength(env, b);
26865         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26866         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
26867         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26868         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
26869         return tag_ptr(ret_conv, true);
26870 }
26871
26872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26873         if (!ptr_is_owned(_res)) return;
26874         void* _res_ptr = untag_ptr(_res);
26875         CHECK_ACCESS(_res_ptr);
26876         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
26877         FREE(untag_ptr(_res));
26878         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
26879 }
26880
26881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26882         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
26883         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26884         if (_res_constr.datalen > 0)
26885                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26886         else
26887                 _res_constr.data = NULL;
26888         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26889         for (size_t x = 0; x < _res_constr.datalen; x++) {
26890                 int64_t _res_conv_23 = _res_vals[x];
26891                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
26892                 CHECK_ACCESS(_res_conv_23_ptr);
26893                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
26894                 FREE(untag_ptr(_res_conv_23));
26895                 _res_constr.data[x] = _res_conv_23_conv;
26896         }
26897         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26898         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
26899 }
26900
26901 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
26902         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26903         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
26904         return tag_ptr(ret_conv, true);
26905 }
26906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26907         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
26908         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
26909         return ret_conv;
26910 }
26911
26912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26913         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
26914         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26915         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
26916         return tag_ptr(ret_conv, true);
26917 }
26918
26919 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) {
26920         LDKThirtyTwoBytes a_ref;
26921         CHECK((*env)->GetArrayLength(env, a) == 32);
26922         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26923         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
26924         b_constr.datalen = (*env)->GetArrayLength(env, b);
26925         if (b_constr.datalen > 0)
26926                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26927         else
26928                 b_constr.data = NULL;
26929         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
26930         for (size_t x = 0; x < b_constr.datalen; x++) {
26931                 int64_t b_conv_23 = b_vals[x];
26932                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
26933                 CHECK_ACCESS(b_conv_23_ptr);
26934                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
26935                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
26936                 b_constr.data[x] = b_conv_23_conv;
26937         }
26938         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
26939         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26940         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
26941         return tag_ptr(ret_conv, true);
26942 }
26943
26944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26945         if (!ptr_is_owned(_res)) return;
26946         void* _res_ptr = untag_ptr(_res);
26947         CHECK_ACCESS(_res_ptr);
26948         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
26949         FREE(untag_ptr(_res));
26950         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
26951 }
26952
26953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26954         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
26955         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26956         if (_res_constr.datalen > 0)
26957                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
26958         else
26959                 _res_constr.data = NULL;
26960         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26961         for (size_t a = 0; a < _res_constr.datalen; a++) {
26962                 int64_t _res_conv_52 = _res_vals[a];
26963                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
26964                 CHECK_ACCESS(_res_conv_52_ptr);
26965                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
26966                 FREE(untag_ptr(_res_conv_52));
26967                 _res_constr.data[a] = _res_conv_52_conv;
26968         }
26969         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26970         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
26971 }
26972
26973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26974         LDKCVec_CommitmentTransactionZ _res_constr;
26975         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26976         if (_res_constr.datalen > 0)
26977                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
26978         else
26979                 _res_constr.data = NULL;
26980         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26981         for (size_t x = 0; x < _res_constr.datalen; x++) {
26982                 int64_t _res_conv_23 = _res_vals[x];
26983                 LDKCommitmentTransaction _res_conv_23_conv;
26984                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
26985                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
26986                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
26987                 _res_constr.data[x] = _res_conv_23_conv;
26988         }
26989         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26990         CVec_CommitmentTransactionZ_free(_res_constr);
26991 }
26992
26993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26994         LDKCVec_TransactionZ _res_constr;
26995         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26996         if (_res_constr.datalen > 0)
26997                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
26998         else
26999                 _res_constr.data = NULL;
27000         for (size_t i = 0; i < _res_constr.datalen; i++) {
27001                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
27002                 LDKTransaction _res_conv_8_ref;
27003                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
27004                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
27005                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
27006                 _res_conv_8_ref.data_is_owned = true;
27007                 _res_constr.data[i] = _res_conv_8_ref;
27008         }
27009         CVec_TransactionZ_free(_res_constr);
27010 }
27011
27012 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
27013         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27014         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
27015         return tag_ptr(ret_conv, true);
27016 }
27017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27018         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
27019         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
27020         return ret_conv;
27021 }
27022
27023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27024         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
27025         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27026         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
27027         return tag_ptr(ret_conv, true);
27028 }
27029
27030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
27031         void* b_ptr = untag_ptr(b);
27032         CHECK_ACCESS(b_ptr);
27033         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
27034         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
27035         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27036         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
27037         return tag_ptr(ret_conv, true);
27038 }
27039
27040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27041         if (!ptr_is_owned(_res)) return;
27042         void* _res_ptr = untag_ptr(_res);
27043         CHECK_ACCESS(_res_ptr);
27044         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
27045         FREE(untag_ptr(_res));
27046         C2Tuple_u32TxOutZ_free(_res_conv);
27047 }
27048
27049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27050         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
27051         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27052         if (_res_constr.datalen > 0)
27053                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27054         else
27055                 _res_constr.data = NULL;
27056         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27057         for (size_t u = 0; u < _res_constr.datalen; u++) {
27058                 int64_t _res_conv_20 = _res_vals[u];
27059                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
27060                 CHECK_ACCESS(_res_conv_20_ptr);
27061                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
27062                 FREE(untag_ptr(_res_conv_20));
27063                 _res_constr.data[u] = _res_conv_20_conv;
27064         }
27065         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27066         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
27067 }
27068
27069 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
27070         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27071         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
27072         return tag_ptr(ret_conv, true);
27073 }
27074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27075         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
27076         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
27077         return ret_conv;
27078 }
27079
27080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27081         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
27082         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27083         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
27084         return tag_ptr(ret_conv, true);
27085 }
27086
27087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
27088         LDKThirtyTwoBytes a_ref;
27089         CHECK((*env)->GetArrayLength(env, a) == 32);
27090         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27091         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
27092         b_constr.datalen = (*env)->GetArrayLength(env, b);
27093         if (b_constr.datalen > 0)
27094                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27095         else
27096                 b_constr.data = NULL;
27097         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
27098         for (size_t u = 0; u < b_constr.datalen; u++) {
27099                 int64_t b_conv_20 = b_vals[u];
27100                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
27101                 CHECK_ACCESS(b_conv_20_ptr);
27102                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
27103                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
27104                 b_constr.data[u] = b_conv_20_conv;
27105         }
27106         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
27107         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27108         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
27109         return tag_ptr(ret_conv, true);
27110 }
27111
27112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27113         if (!ptr_is_owned(_res)) return;
27114         void* _res_ptr = untag_ptr(_res);
27115         CHECK_ACCESS(_res_ptr);
27116         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
27117         FREE(untag_ptr(_res));
27118         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
27119 }
27120
27121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27122         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
27123         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27124         if (_res_constr.datalen > 0)
27125                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
27126         else
27127                 _res_constr.data = NULL;
27128         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27129         for (size_t x = 0; x < _res_constr.datalen; x++) {
27130                 int64_t _res_conv_49 = _res_vals[x];
27131                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
27132                 CHECK_ACCESS(_res_conv_49_ptr);
27133                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
27134                 FREE(untag_ptr(_res_conv_49));
27135                 _res_constr.data[x] = _res_conv_49_conv;
27136         }
27137         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27138         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
27139 }
27140
27141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27142         LDKCVec_BalanceZ _res_constr;
27143         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27144         if (_res_constr.datalen > 0)
27145                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
27146         else
27147                 _res_constr.data = NULL;
27148         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27149         for (size_t j = 0; j < _res_constr.datalen; j++) {
27150                 int64_t _res_conv_9 = _res_vals[j];
27151                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
27152                 CHECK_ACCESS(_res_conv_9_ptr);
27153                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
27154                 FREE(untag_ptr(_res_conv_9));
27155                 _res_constr.data[j] = _res_conv_9_conv;
27156         }
27157         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27158         CVec_BalanceZ_free(_res_constr);
27159 }
27160
27161 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
27162         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27163         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
27164         return tag_ptr(ret_conv, true);
27165 }
27166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27167         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
27168         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
27169         return ret_conv;
27170 }
27171
27172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27173         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
27174         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27175         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
27176         return tag_ptr(ret_conv, true);
27177 }
27178
27179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27180         LDKThirtyTwoBytes a_ref;
27181         CHECK((*env)->GetArrayLength(env, a) == 32);
27182         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27183         LDKChannelMonitor b_conv;
27184         b_conv.inner = untag_ptr(b);
27185         b_conv.is_owned = ptr_is_owned(b);
27186         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27187         b_conv = ChannelMonitor_clone(&b_conv);
27188         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27189         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
27190         return tag_ptr(ret_conv, true);
27191 }
27192
27193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27194         if (!ptr_is_owned(_res)) return;
27195         void* _res_ptr = untag_ptr(_res);
27196         CHECK_ACCESS(_res_ptr);
27197         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
27198         FREE(untag_ptr(_res));
27199         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
27200 }
27201
27202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27203         void* o_ptr = untag_ptr(o);
27204         CHECK_ACCESS(o_ptr);
27205         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27206         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27207         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27208         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
27209         return tag_ptr(ret_conv, true);
27210 }
27211
27212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27213         void* e_ptr = untag_ptr(e);
27214         CHECK_ACCESS(e_ptr);
27215         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27216         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27217         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27218         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
27219         return tag_ptr(ret_conv, true);
27220 }
27221
27222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27223         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
27224         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
27225         return ret_conv;
27226 }
27227
27228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27229         if (!ptr_is_owned(_res)) return;
27230         void* _res_ptr = untag_ptr(_res);
27231         CHECK_ACCESS(_res_ptr);
27232         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
27233         FREE(untag_ptr(_res));
27234         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
27235 }
27236
27237 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
27238         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27239         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
27240         return tag_ptr(ret_conv, true);
27241 }
27242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27243         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
27244         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
27245         return ret_conv;
27246 }
27247
27248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27249         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
27250         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27251         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
27252         return tag_ptr(ret_conv, true);
27253 }
27254
27255 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
27256         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27257         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
27258         return tag_ptr(ret_conv, true);
27259 }
27260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27261         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
27262         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
27263         return ret_conv;
27264 }
27265
27266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27267         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
27268         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27269         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
27270         return tag_ptr(ret_conv, true);
27271 }
27272
27273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27274         LDKPublicKey a_ref;
27275         CHECK((*env)->GetArrayLength(env, a) == 33);
27276         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
27277         void* b_ptr = untag_ptr(b);
27278         CHECK_ACCESS(b_ptr);
27279         LDKType b_conv = *(LDKType*)(b_ptr);
27280         if (b_conv.free == LDKType_JCalls_free) {
27281                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27282                 LDKType_JCalls_cloned(&b_conv);
27283         }
27284         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27285         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
27286         return tag_ptr(ret_conv, true);
27287 }
27288
27289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27290         if (!ptr_is_owned(_res)) return;
27291         void* _res_ptr = untag_ptr(_res);
27292         CHECK_ACCESS(_res_ptr);
27293         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
27294         FREE(untag_ptr(_res));
27295         C2Tuple_PublicKeyTypeZ_free(_res_conv);
27296 }
27297
27298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27299         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
27300         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27301         if (_res_constr.datalen > 0)
27302                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
27303         else
27304                 _res_constr.data = NULL;
27305         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27306         for (size_t z = 0; z < _res_constr.datalen; z++) {
27307                 int64_t _res_conv_25 = _res_vals[z];
27308                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
27309                 CHECK_ACCESS(_res_conv_25_ptr);
27310                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
27311                 FREE(untag_ptr(_res_conv_25));
27312                 _res_constr.data[z] = _res_conv_25_conv;
27313         }
27314         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27315         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
27316 }
27317
27318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27319         void* o_ptr = untag_ptr(o);
27320         CHECK_ACCESS(o_ptr);
27321         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
27322         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
27323         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27324         *ret_copy = COption_OffersMessageZ_some(o_conv);
27325         int64_t ret_ref = tag_ptr(ret_copy, true);
27326         return ret_ref;
27327 }
27328
27329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
27330         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27331         *ret_copy = COption_OffersMessageZ_none();
27332         int64_t ret_ref = tag_ptr(ret_copy, true);
27333         return ret_ref;
27334 }
27335
27336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27337         if (!ptr_is_owned(_res)) return;
27338         void* _res_ptr = untag_ptr(_res);
27339         CHECK_ACCESS(_res_ptr);
27340         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
27341         FREE(untag_ptr(_res));
27342         COption_OffersMessageZ_free(_res_conv);
27343 }
27344
27345 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
27346         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27347         *ret_copy = COption_OffersMessageZ_clone(arg);
27348         int64_t ret_ref = tag_ptr(ret_copy, true);
27349         return ret_ref;
27350 }
27351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27352         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
27353         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
27354         return ret_conv;
27355 }
27356
27357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27358         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
27359         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27360         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
27361         int64_t ret_ref = tag_ptr(ret_copy, true);
27362         return ret_ref;
27363 }
27364
27365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27366         void* o_ptr = untag_ptr(o);
27367         CHECK_ACCESS(o_ptr);
27368         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
27369         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
27370                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27371                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
27372         }
27373         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27374         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
27375         int64_t ret_ref = tag_ptr(ret_copy, true);
27376         return ret_ref;
27377 }
27378
27379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
27380         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27381         *ret_copy = COption_CustomOnionMessageContentsZ_none();
27382         int64_t ret_ref = tag_ptr(ret_copy, true);
27383         return ret_ref;
27384 }
27385
27386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27387         if (!ptr_is_owned(_res)) return;
27388         void* _res_ptr = untag_ptr(_res);
27389         CHECK_ACCESS(_res_ptr);
27390         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
27391         FREE(untag_ptr(_res));
27392         COption_CustomOnionMessageContentsZ_free(_res_conv);
27393 }
27394
27395 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
27396         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27397         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
27398         int64_t ret_ref = tag_ptr(ret_copy, true);
27399         return ret_ref;
27400 }
27401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27402         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
27403         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
27404         return ret_conv;
27405 }
27406
27407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27408         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
27409         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27410         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
27411         int64_t ret_ref = tag_ptr(ret_copy, true);
27412         return ret_ref;
27413 }
27414
27415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27416         void* o_ptr = untag_ptr(o);
27417         CHECK_ACCESS(o_ptr);
27418         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
27419         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
27420         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27421         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
27422         return tag_ptr(ret_conv, true);
27423 }
27424
27425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27426         void* e_ptr = untag_ptr(e);
27427         CHECK_ACCESS(e_ptr);
27428         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27429         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27430         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27431         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
27432         return tag_ptr(ret_conv, true);
27433 }
27434
27435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27436         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
27437         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
27438         return ret_conv;
27439 }
27440
27441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27442         if (!ptr_is_owned(_res)) return;
27443         void* _res_ptr = untag_ptr(_res);
27444         CHECK_ACCESS(_res_ptr);
27445         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
27446         FREE(untag_ptr(_res));
27447         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
27448 }
27449
27450 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
27451         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27452         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
27453         return tag_ptr(ret_conv, true);
27454 }
27455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27456         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
27457         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
27458         return ret_conv;
27459 }
27460
27461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27462         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
27463         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27464         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
27465         return tag_ptr(ret_conv, true);
27466 }
27467
27468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27469         void* o_ptr = untag_ptr(o);
27470         CHECK_ACCESS(o_ptr);
27471         LDKType o_conv = *(LDKType*)(o_ptr);
27472         if (o_conv.free == LDKType_JCalls_free) {
27473                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27474                 LDKType_JCalls_cloned(&o_conv);
27475         }
27476         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27477         *ret_copy = COption_TypeZ_some(o_conv);
27478         int64_t ret_ref = tag_ptr(ret_copy, true);
27479         return ret_ref;
27480 }
27481
27482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
27483         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27484         *ret_copy = COption_TypeZ_none();
27485         int64_t ret_ref = tag_ptr(ret_copy, true);
27486         return ret_ref;
27487 }
27488
27489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27490         if (!ptr_is_owned(_res)) return;
27491         void* _res_ptr = untag_ptr(_res);
27492         CHECK_ACCESS(_res_ptr);
27493         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
27494         FREE(untag_ptr(_res));
27495         COption_TypeZ_free(_res_conv);
27496 }
27497
27498 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
27499         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27500         *ret_copy = COption_TypeZ_clone(arg);
27501         int64_t ret_ref = tag_ptr(ret_copy, true);
27502         return ret_ref;
27503 }
27504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27505         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
27506         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
27507         return ret_conv;
27508 }
27509
27510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27511         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
27512         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27513         *ret_copy = COption_TypeZ_clone(orig_conv);
27514         int64_t ret_ref = tag_ptr(ret_copy, true);
27515         return ret_ref;
27516 }
27517
27518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27519         void* o_ptr = untag_ptr(o);
27520         CHECK_ACCESS(o_ptr);
27521         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
27522         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
27523         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27524         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
27525         return tag_ptr(ret_conv, true);
27526 }
27527
27528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27529         void* e_ptr = untag_ptr(e);
27530         CHECK_ACCESS(e_ptr);
27531         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27532         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27533         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27534         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
27535         return tag_ptr(ret_conv, true);
27536 }
27537
27538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27539         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
27540         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
27541         return ret_conv;
27542 }
27543
27544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27545         if (!ptr_is_owned(_res)) return;
27546         void* _res_ptr = untag_ptr(_res);
27547         CHECK_ACCESS(_res_ptr);
27548         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
27549         FREE(untag_ptr(_res));
27550         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
27551 }
27552
27553 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
27554         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27555         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
27556         return tag_ptr(ret_conv, true);
27557 }
27558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27559         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
27560         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
27561         return ret_conv;
27562 }
27563
27564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27565         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
27566         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27567         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
27568         return tag_ptr(ret_conv, true);
27569 }
27570
27571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27572         void* o_ptr = untag_ptr(o);
27573         CHECK_ACCESS(o_ptr);
27574         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27575         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27576         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27577         *ret_copy = COption_SocketAddressZ_some(o_conv);
27578         int64_t ret_ref = tag_ptr(ret_copy, true);
27579         return ret_ref;
27580 }
27581
27582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
27583         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27584         *ret_copy = COption_SocketAddressZ_none();
27585         int64_t ret_ref = tag_ptr(ret_copy, true);
27586         return ret_ref;
27587 }
27588
27589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27590         if (!ptr_is_owned(_res)) return;
27591         void* _res_ptr = untag_ptr(_res);
27592         CHECK_ACCESS(_res_ptr);
27593         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
27594         FREE(untag_ptr(_res));
27595         COption_SocketAddressZ_free(_res_conv);
27596 }
27597
27598 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
27599         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27600         *ret_copy = COption_SocketAddressZ_clone(arg);
27601         int64_t ret_ref = tag_ptr(ret_copy, true);
27602         return ret_ref;
27603 }
27604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27605         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
27606         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
27607         return ret_conv;
27608 }
27609
27610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27611         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
27612         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27613         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
27614         int64_t ret_ref = tag_ptr(ret_copy, true);
27615         return ret_ref;
27616 }
27617
27618 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
27619         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
27620         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
27621         return tag_ptr(ret_conv, true);
27622 }
27623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27624         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
27625         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
27626         return ret_conv;
27627 }
27628
27629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27630         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
27631         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
27632         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
27633         return tag_ptr(ret_conv, true);
27634 }
27635
27636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27637         LDKPublicKey a_ref;
27638         CHECK((*env)->GetArrayLength(env, a) == 33);
27639         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
27640         void* b_ptr = untag_ptr(b);
27641         CHECK_ACCESS(b_ptr);
27642         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
27643         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
27644         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
27645         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
27646         return tag_ptr(ret_conv, true);
27647 }
27648
27649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27650         if (!ptr_is_owned(_res)) return;
27651         void* _res_ptr = untag_ptr(_res);
27652         CHECK_ACCESS(_res_ptr);
27653         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
27654         FREE(untag_ptr(_res));
27655         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
27656 }
27657
27658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27659         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
27660         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27661         if (_res_constr.datalen > 0)
27662                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
27663         else
27664                 _res_constr.data = NULL;
27665         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27666         for (size_t r = 0; r < _res_constr.datalen; r++) {
27667                 int64_t _res_conv_43 = _res_vals[r];
27668                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
27669                 CHECK_ACCESS(_res_conv_43_ptr);
27670                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
27671                 FREE(untag_ptr(_res_conv_43));
27672                 _res_constr.data[r] = _res_conv_43_conv;
27673         }
27674         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27675         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
27676 }
27677
27678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27679         LDKCVec_u8Z o_ref;
27680         o_ref.datalen = (*env)->GetArrayLength(env, o);
27681         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
27682         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
27683         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27684         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
27685         return tag_ptr(ret_conv, true);
27686 }
27687
27688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27689         LDKPeerHandleError e_conv;
27690         e_conv.inner = untag_ptr(e);
27691         e_conv.is_owned = ptr_is_owned(e);
27692         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27693         e_conv = PeerHandleError_clone(&e_conv);
27694         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27695         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
27696         return tag_ptr(ret_conv, true);
27697 }
27698
27699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27700         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
27701         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
27702         return ret_conv;
27703 }
27704
27705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27706         if (!ptr_is_owned(_res)) return;
27707         void* _res_ptr = untag_ptr(_res);
27708         CHECK_ACCESS(_res_ptr);
27709         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
27710         FREE(untag_ptr(_res));
27711         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
27712 }
27713
27714 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
27715         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27716         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
27717         return tag_ptr(ret_conv, true);
27718 }
27719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27720         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
27721         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
27722         return ret_conv;
27723 }
27724
27725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27726         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
27727         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27728         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
27729         return tag_ptr(ret_conv, true);
27730 }
27731
27732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
27733         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27734         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
27735         return tag_ptr(ret_conv, true);
27736 }
27737
27738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27739         LDKPeerHandleError e_conv;
27740         e_conv.inner = untag_ptr(e);
27741         e_conv.is_owned = ptr_is_owned(e);
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27743         e_conv = PeerHandleError_clone(&e_conv);
27744         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27745         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
27746         return tag_ptr(ret_conv, true);
27747 }
27748
27749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27750         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
27751         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
27752         return ret_conv;
27753 }
27754
27755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27756         if (!ptr_is_owned(_res)) return;
27757         void* _res_ptr = untag_ptr(_res);
27758         CHECK_ACCESS(_res_ptr);
27759         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
27760         FREE(untag_ptr(_res));
27761         CResult_NonePeerHandleErrorZ_free(_res_conv);
27762 }
27763
27764 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
27765         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27766         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
27767         return tag_ptr(ret_conv, true);
27768 }
27769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27770         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
27771         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
27772         return ret_conv;
27773 }
27774
27775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27776         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
27777         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27778         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
27779         return tag_ptr(ret_conv, true);
27780 }
27781
27782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
27783         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27784         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
27785         return tag_ptr(ret_conv, true);
27786 }
27787
27788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27789         LDKPeerHandleError e_conv;
27790         e_conv.inner = untag_ptr(e);
27791         e_conv.is_owned = ptr_is_owned(e);
27792         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27793         e_conv = PeerHandleError_clone(&e_conv);
27794         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27795         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
27796         return tag_ptr(ret_conv, true);
27797 }
27798
27799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27800         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
27801         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
27802         return ret_conv;
27803 }
27804
27805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27806         if (!ptr_is_owned(_res)) return;
27807         void* _res_ptr = untag_ptr(_res);
27808         CHECK_ACCESS(_res_ptr);
27809         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
27810         FREE(untag_ptr(_res));
27811         CResult_boolPeerHandleErrorZ_free(_res_conv);
27812 }
27813
27814 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
27815         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27816         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
27817         return tag_ptr(ret_conv, true);
27818 }
27819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27820         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
27821         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
27822         return ret_conv;
27823 }
27824
27825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27826         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
27827         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27828         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
27829         return tag_ptr(ret_conv, true);
27830 }
27831
27832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
27833         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27834         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
27835         return tag_ptr(ret_conv, true);
27836 }
27837
27838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27839         void* e_ptr = untag_ptr(e);
27840         CHECK_ACCESS(e_ptr);
27841         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
27842         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
27843         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27844         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
27845         return tag_ptr(ret_conv, true);
27846 }
27847
27848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27849         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
27850         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
27851         return ret_conv;
27852 }
27853
27854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27855         if (!ptr_is_owned(_res)) return;
27856         void* _res_ptr = untag_ptr(_res);
27857         CHECK_ACCESS(_res_ptr);
27858         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
27859         FREE(untag_ptr(_res));
27860         CResult_u32GraphSyncErrorZ_free(_res_conv);
27861 }
27862
27863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27864         LDKCVec_u8Z o_ref;
27865         o_ref.datalen = (*env)->GetArrayLength(env, o);
27866         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
27867         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
27868         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27869         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
27870         return tag_ptr(ret_conv, true);
27871 }
27872
27873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
27874         LDKIOError e_conv = LDKIOError_from_java(env, e);
27875         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27876         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
27877         return tag_ptr(ret_conv, true);
27878 }
27879
27880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27881         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
27882         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
27883         return ret_conv;
27884 }
27885
27886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27887         if (!ptr_is_owned(_res)) return;
27888         void* _res_ptr = untag_ptr(_res);
27889         CHECK_ACCESS(_res_ptr);
27890         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
27891         FREE(untag_ptr(_res));
27892         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
27893 }
27894
27895 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
27896         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27897         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
27898         return tag_ptr(ret_conv, true);
27899 }
27900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27901         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
27902         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
27903         return ret_conv;
27904 }
27905
27906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27907         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
27908         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27909         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
27910         return tag_ptr(ret_conv, true);
27911 }
27912
27913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
27914         LDKCVec_StrZ _res_constr;
27915         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27916         if (_res_constr.datalen > 0)
27917                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27918         else
27919                 _res_constr.data = NULL;
27920         for (size_t i = 0; i < _res_constr.datalen; i++) {
27921                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
27922                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
27923                 _res_constr.data[i] = dummy;
27924         }
27925         CVec_StrZ_free(_res_constr);
27926 }
27927
27928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
27929         LDKCVec_StrZ o_constr;
27930         o_constr.datalen = (*env)->GetArrayLength(env, o);
27931         if (o_constr.datalen > 0)
27932                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27933         else
27934                 o_constr.data = NULL;
27935         for (size_t i = 0; i < o_constr.datalen; i++) {
27936                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
27937                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
27938                 o_constr.data[i] = o_conv_8_conv;
27939         }
27940         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27941         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
27942         return tag_ptr(ret_conv, true);
27943 }
27944
27945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
27946         LDKIOError e_conv = LDKIOError_from_java(env, e);
27947         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27948         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
27949         return tag_ptr(ret_conv, true);
27950 }
27951
27952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27953         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
27954         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
27955         return ret_conv;
27956 }
27957
27958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27959         if (!ptr_is_owned(_res)) return;
27960         void* _res_ptr = untag_ptr(_res);
27961         CHECK_ACCESS(_res_ptr);
27962         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
27963         FREE(untag_ptr(_res));
27964         CResult_CVec_StrZIOErrorZ_free(_res_conv);
27965 }
27966
27967 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
27968         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27969         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
27970         return tag_ptr(ret_conv, true);
27971 }
27972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27973         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
27974         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
27975         return ret_conv;
27976 }
27977
27978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27979         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
27980         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27981         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
27982         return tag_ptr(ret_conv, true);
27983 }
27984
27985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27986         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
27987         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27988         if (_res_constr.datalen > 0)
27989                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27990         else
27991                 _res_constr.data = NULL;
27992         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27993         for (size_t o = 0; o < _res_constr.datalen; o++) {
27994                 int64_t _res_conv_40 = _res_vals[o];
27995                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27996                 CHECK_ACCESS(_res_conv_40_ptr);
27997                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
27998                 FREE(untag_ptr(_res_conv_40));
27999                 _res_constr.data[o] = _res_conv_40_conv;
28000         }
28001         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28002         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
28003 }
28004
28005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
28006         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
28007         o_constr.datalen = (*env)->GetArrayLength(env, o);
28008         if (o_constr.datalen > 0)
28009                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
28010         else
28011                 o_constr.data = NULL;
28012         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
28013         for (size_t o = 0; o < o_constr.datalen; o++) {
28014                 int64_t o_conv_40 = o_vals[o];
28015                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28016                 CHECK_ACCESS(o_conv_40_ptr);
28017                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
28018                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
28019                 o_constr.data[o] = o_conv_40_conv;
28020         }
28021         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
28022         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28023         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
28024         return tag_ptr(ret_conv, true);
28025 }
28026
28027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28028         LDKIOError e_conv = LDKIOError_from_java(env, e);
28029         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28030         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
28031         return tag_ptr(ret_conv, true);
28032 }
28033
28034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28035         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
28036         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
28037         return ret_conv;
28038 }
28039
28040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28041         if (!ptr_is_owned(_res)) return;
28042         void* _res_ptr = untag_ptr(_res);
28043         CHECK_ACCESS(_res_ptr);
28044         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
28045         FREE(untag_ptr(_res));
28046         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
28047 }
28048
28049 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
28050         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28051         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
28052         return tag_ptr(ret_conv, true);
28053 }
28054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28055         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
28056         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
28057         return ret_conv;
28058 }
28059
28060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28061         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
28062         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28063         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
28064         return tag_ptr(ret_conv, true);
28065 }
28066
28067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28068         void* o_ptr = untag_ptr(o);
28069         CHECK_ACCESS(o_ptr);
28070         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
28071         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
28072         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28073         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
28074         return tag_ptr(ret_conv, true);
28075 }
28076
28077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28078         LDKIOError e_conv = LDKIOError_from_java(env, e);
28079         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28080         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
28081         return tag_ptr(ret_conv, true);
28082 }
28083
28084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28085         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
28086         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
28087         return ret_conv;
28088 }
28089
28090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28091         if (!ptr_is_owned(_res)) return;
28092         void* _res_ptr = untag_ptr(_res);
28093         CHECK_ACCESS(_res_ptr);
28094         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
28095         FREE(untag_ptr(_res));
28096         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
28097 }
28098
28099 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
28100         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28101         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
28102         return tag_ptr(ret_conv, true);
28103 }
28104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28105         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
28106         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
28107         return ret_conv;
28108 }
28109
28110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28111         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
28112         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28113         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
28114         return tag_ptr(ret_conv, true);
28115 }
28116
28117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
28118         LDKSecretKey o_ref;
28119         CHECK((*env)->GetArrayLength(env, o) == 32);
28120         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
28121         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28122         *ret_copy = COption_SecretKeyZ_some(o_ref);
28123         int64_t ret_ref = tag_ptr(ret_copy, true);
28124         return ret_ref;
28125 }
28126
28127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
28128         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28129         *ret_copy = COption_SecretKeyZ_none();
28130         int64_t ret_ref = tag_ptr(ret_copy, true);
28131         return ret_ref;
28132 }
28133
28134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28135         if (!ptr_is_owned(_res)) return;
28136         void* _res_ptr = untag_ptr(_res);
28137         CHECK_ACCESS(_res_ptr);
28138         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
28139         FREE(untag_ptr(_res));
28140         COption_SecretKeyZ_free(_res_conv);
28141 }
28142
28143 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
28144         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28145         *ret_copy = COption_SecretKeyZ_clone(arg);
28146         int64_t ret_ref = tag_ptr(ret_copy, true);
28147         return ret_ref;
28148 }
28149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28150         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
28151         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
28152         return ret_conv;
28153 }
28154
28155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28156         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
28157         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28158         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
28159         int64_t ret_ref = tag_ptr(ret_copy, true);
28160         return ret_ref;
28161 }
28162
28163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28164         LDKVerifiedInvoiceRequest o_conv;
28165         o_conv.inner = untag_ptr(o);
28166         o_conv.is_owned = ptr_is_owned(o);
28167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28168         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
28169         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28170         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
28171         return tag_ptr(ret_conv, true);
28172 }
28173
28174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
28175         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28176         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
28177         return tag_ptr(ret_conv, true);
28178 }
28179
28180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28181         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
28182         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
28183         return ret_conv;
28184 }
28185
28186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28187         if (!ptr_is_owned(_res)) return;
28188         void* _res_ptr = untag_ptr(_res);
28189         CHECK_ACCESS(_res_ptr);
28190         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
28191         FREE(untag_ptr(_res));
28192         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
28193 }
28194
28195 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
28196         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28197         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
28198         return tag_ptr(ret_conv, true);
28199 }
28200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28201         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
28202         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
28203         return ret_conv;
28204 }
28205
28206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28207         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
28208         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28209         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
28210         return tag_ptr(ret_conv, true);
28211 }
28212
28213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
28214         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
28215         return ret_conv;
28216 }
28217
28218 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
28219         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
28220         return ret_conv;
28221 }
28222
28223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
28224         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
28225         COption_NoneZ_free(_res_conv);
28226 }
28227
28228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
28229         LDKCVec_WitnessZ _res_constr;
28230         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28231         if (_res_constr.datalen > 0)
28232                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
28233         else
28234                 _res_constr.data = NULL;
28235         for (size_t i = 0; i < _res_constr.datalen; i++) {
28236                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
28237                 LDKWitness _res_conv_8_ref;
28238                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
28239                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
28240                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
28241                 _res_conv_8_ref.data_is_owned = true;
28242                 _res_constr.data[i] = _res_conv_8_ref;
28243         }
28244         CVec_WitnessZ_free(_res_constr);
28245 }
28246
28247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
28248         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28249         *ret_copy = COption_i64Z_some(o);
28250         int64_t ret_ref = tag_ptr(ret_copy, true);
28251         return ret_ref;
28252 }
28253
28254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
28255         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28256         *ret_copy = COption_i64Z_none();
28257         int64_t ret_ref = tag_ptr(ret_copy, true);
28258         return ret_ref;
28259 }
28260
28261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
28262         if (!ptr_is_owned(_res)) return;
28263         void* _res_ptr = untag_ptr(_res);
28264         CHECK_ACCESS(_res_ptr);
28265         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
28266         FREE(untag_ptr(_res));
28267         COption_i64Z_free(_res_conv);
28268 }
28269
28270 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
28271         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28272         *ret_copy = COption_i64Z_clone(arg);
28273         int64_t ret_ref = tag_ptr(ret_copy, true);
28274         return ret_ref;
28275 }
28276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28277         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
28278         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
28279         return ret_conv;
28280 }
28281
28282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28283         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
28284         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28285         *ret_copy = COption_i64Z_clone(orig_conv);
28286         int64_t ret_ref = tag_ptr(ret_copy, true);
28287         return ret_ref;
28288 }
28289
28290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28291         void* o_ptr = untag_ptr(o);
28292         CHECK_ACCESS(o_ptr);
28293         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28294         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28295         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28296         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
28297         return tag_ptr(ret_conv, true);
28298 }
28299
28300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28301         void* e_ptr = untag_ptr(e);
28302         CHECK_ACCESS(e_ptr);
28303         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28304         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28305         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28306         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
28307         return tag_ptr(ret_conv, true);
28308 }
28309
28310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28311         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
28312         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
28313         return ret_conv;
28314 }
28315
28316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28317         if (!ptr_is_owned(_res)) return;
28318         void* _res_ptr = untag_ptr(_res);
28319         CHECK_ACCESS(_res_ptr);
28320         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
28321         FREE(untag_ptr(_res));
28322         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
28323 }
28324
28325 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
28326         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28327         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
28328         return tag_ptr(ret_conv, true);
28329 }
28330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28331         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
28332         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
28333         return ret_conv;
28334 }
28335
28336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28337         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
28338         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28339         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
28340         return tag_ptr(ret_conv, true);
28341 }
28342
28343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28344         void* o_ptr = untag_ptr(o);
28345         CHECK_ACCESS(o_ptr);
28346         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28347         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28348         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28349         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
28350         return tag_ptr(ret_conv, true);
28351 }
28352
28353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28354         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
28355         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28356         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
28357         return tag_ptr(ret_conv, true);
28358 }
28359
28360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28361         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
28362         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
28363         return ret_conv;
28364 }
28365
28366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28367         if (!ptr_is_owned(_res)) return;
28368         void* _res_ptr = untag_ptr(_res);
28369         CHECK_ACCESS(_res_ptr);
28370         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
28371         FREE(untag_ptr(_res));
28372         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
28373 }
28374
28375 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
28376         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28377         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
28378         return tag_ptr(ret_conv, true);
28379 }
28380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28381         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
28382         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
28383         return ret_conv;
28384 }
28385
28386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28387         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
28388         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28389         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
28390         return tag_ptr(ret_conv, true);
28391 }
28392
28393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28394         LDKCVec_UpdateAddHTLCZ _res_constr;
28395         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28396         if (_res_constr.datalen > 0)
28397                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
28398         else
28399                 _res_constr.data = NULL;
28400         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28401         for (size_t p = 0; p < _res_constr.datalen; p++) {
28402                 int64_t _res_conv_15 = _res_vals[p];
28403                 LDKUpdateAddHTLC _res_conv_15_conv;
28404                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
28405                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
28406                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
28407                 _res_constr.data[p] = _res_conv_15_conv;
28408         }
28409         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28410         CVec_UpdateAddHTLCZ_free(_res_constr);
28411 }
28412
28413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28414         LDKCVec_UpdateFulfillHTLCZ _res_constr;
28415         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28416         if (_res_constr.datalen > 0)
28417                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
28418         else
28419                 _res_constr.data = NULL;
28420         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28421         for (size_t t = 0; t < _res_constr.datalen; t++) {
28422                 int64_t _res_conv_19 = _res_vals[t];
28423                 LDKUpdateFulfillHTLC _res_conv_19_conv;
28424                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28425                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28426                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28427                 _res_constr.data[t] = _res_conv_19_conv;
28428         }
28429         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28430         CVec_UpdateFulfillHTLCZ_free(_res_constr);
28431 }
28432
28433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28434         LDKCVec_UpdateFailHTLCZ _res_constr;
28435         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28436         if (_res_constr.datalen > 0)
28437                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
28438         else
28439                 _res_constr.data = NULL;
28440         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28441         for (size_t q = 0; q < _res_constr.datalen; q++) {
28442                 int64_t _res_conv_16 = _res_vals[q];
28443                 LDKUpdateFailHTLC _res_conv_16_conv;
28444                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
28445                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
28446                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
28447                 _res_constr.data[q] = _res_conv_16_conv;
28448         }
28449         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28450         CVec_UpdateFailHTLCZ_free(_res_constr);
28451 }
28452
28453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28454         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
28455         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28456         if (_res_constr.datalen > 0)
28457                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
28458         else
28459                 _res_constr.data = NULL;
28460         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28461         for (size_t z = 0; z < _res_constr.datalen; z++) {
28462                 int64_t _res_conv_25 = _res_vals[z];
28463                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
28464                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
28465                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
28466                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
28467                 _res_constr.data[z] = _res_conv_25_conv;
28468         }
28469         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28470         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
28471 }
28472
28473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28474         LDKAcceptChannel o_conv;
28475         o_conv.inner = untag_ptr(o);
28476         o_conv.is_owned = ptr_is_owned(o);
28477         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28478         o_conv = AcceptChannel_clone(&o_conv);
28479         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28480         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
28481         return tag_ptr(ret_conv, true);
28482 }
28483
28484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28485         void* e_ptr = untag_ptr(e);
28486         CHECK_ACCESS(e_ptr);
28487         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28488         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28489         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28490         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
28491         return tag_ptr(ret_conv, true);
28492 }
28493
28494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28495         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
28496         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
28497         return ret_conv;
28498 }
28499
28500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28501         if (!ptr_is_owned(_res)) return;
28502         void* _res_ptr = untag_ptr(_res);
28503         CHECK_ACCESS(_res_ptr);
28504         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
28505         FREE(untag_ptr(_res));
28506         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
28507 }
28508
28509 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
28510         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28511         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
28512         return tag_ptr(ret_conv, true);
28513 }
28514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28515         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
28516         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
28517         return ret_conv;
28518 }
28519
28520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28521         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
28522         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28523         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
28524         return tag_ptr(ret_conv, true);
28525 }
28526
28527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28528         LDKAcceptChannelV2 o_conv;
28529         o_conv.inner = untag_ptr(o);
28530         o_conv.is_owned = ptr_is_owned(o);
28531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28532         o_conv = AcceptChannelV2_clone(&o_conv);
28533         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28534         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
28535         return tag_ptr(ret_conv, true);
28536 }
28537
28538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28539         void* e_ptr = untag_ptr(e);
28540         CHECK_ACCESS(e_ptr);
28541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28543         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28544         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
28545         return tag_ptr(ret_conv, true);
28546 }
28547
28548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28549         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
28550         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
28551         return ret_conv;
28552 }
28553
28554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28555         if (!ptr_is_owned(_res)) return;
28556         void* _res_ptr = untag_ptr(_res);
28557         CHECK_ACCESS(_res_ptr);
28558         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
28559         FREE(untag_ptr(_res));
28560         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
28561 }
28562
28563 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
28564         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28565         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
28566         return tag_ptr(ret_conv, true);
28567 }
28568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28569         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
28570         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
28571         return ret_conv;
28572 }
28573
28574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28575         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
28576         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28577         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
28578         return tag_ptr(ret_conv, true);
28579 }
28580
28581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28582         LDKTxAddInput o_conv;
28583         o_conv.inner = untag_ptr(o);
28584         o_conv.is_owned = ptr_is_owned(o);
28585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28586         o_conv = TxAddInput_clone(&o_conv);
28587         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28588         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28589         return tag_ptr(ret_conv, true);
28590 }
28591
28592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28593         void* e_ptr = untag_ptr(e);
28594         CHECK_ACCESS(e_ptr);
28595         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28596         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28597         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28598         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28599         return tag_ptr(ret_conv, true);
28600 }
28601
28602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28603         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28604         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28605         return ret_conv;
28606 }
28607
28608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28609         if (!ptr_is_owned(_res)) return;
28610         void* _res_ptr = untag_ptr(_res);
28611         CHECK_ACCESS(_res_ptr);
28612         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28613         FREE(untag_ptr(_res));
28614         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28615 }
28616
28617 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28618         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28619         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28620         return tag_ptr(ret_conv, true);
28621 }
28622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28623         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28624         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28625         return ret_conv;
28626 }
28627
28628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28629         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28630         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28631         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28632         return tag_ptr(ret_conv, true);
28633 }
28634
28635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28636         LDKTxAddOutput o_conv;
28637         o_conv.inner = untag_ptr(o);
28638         o_conv.is_owned = ptr_is_owned(o);
28639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28640         o_conv = TxAddOutput_clone(&o_conv);
28641         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28642         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28643         return tag_ptr(ret_conv, true);
28644 }
28645
28646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28647         void* e_ptr = untag_ptr(e);
28648         CHECK_ACCESS(e_ptr);
28649         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28650         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28651         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28652         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28653         return tag_ptr(ret_conv, true);
28654 }
28655
28656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28657         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28658         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28659         return ret_conv;
28660 }
28661
28662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28663         if (!ptr_is_owned(_res)) return;
28664         void* _res_ptr = untag_ptr(_res);
28665         CHECK_ACCESS(_res_ptr);
28666         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28667         FREE(untag_ptr(_res));
28668         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28669 }
28670
28671 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28672         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28673         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28674         return tag_ptr(ret_conv, true);
28675 }
28676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28677         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28678         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28679         return ret_conv;
28680 }
28681
28682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28683         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28684         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28685         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28686         return tag_ptr(ret_conv, true);
28687 }
28688
28689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28690         LDKTxRemoveInput o_conv;
28691         o_conv.inner = untag_ptr(o);
28692         o_conv.is_owned = ptr_is_owned(o);
28693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28694         o_conv = TxRemoveInput_clone(&o_conv);
28695         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28696         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28697         return tag_ptr(ret_conv, true);
28698 }
28699
28700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28701         void* e_ptr = untag_ptr(e);
28702         CHECK_ACCESS(e_ptr);
28703         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28704         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28705         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28706         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28707         return tag_ptr(ret_conv, true);
28708 }
28709
28710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28711         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28712         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28713         return ret_conv;
28714 }
28715
28716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28717         if (!ptr_is_owned(_res)) return;
28718         void* _res_ptr = untag_ptr(_res);
28719         CHECK_ACCESS(_res_ptr);
28720         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28721         FREE(untag_ptr(_res));
28722         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28723 }
28724
28725 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28726         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28727         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28728         return tag_ptr(ret_conv, true);
28729 }
28730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28731         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28732         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28733         return ret_conv;
28734 }
28735
28736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28737         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28738         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28739         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28740         return tag_ptr(ret_conv, true);
28741 }
28742
28743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28744         LDKTxRemoveOutput o_conv;
28745         o_conv.inner = untag_ptr(o);
28746         o_conv.is_owned = ptr_is_owned(o);
28747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28748         o_conv = TxRemoveOutput_clone(&o_conv);
28749         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28750         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28751         return tag_ptr(ret_conv, true);
28752 }
28753
28754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28755         void* e_ptr = untag_ptr(e);
28756         CHECK_ACCESS(e_ptr);
28757         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28758         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28759         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28760         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28761         return tag_ptr(ret_conv, true);
28762 }
28763
28764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28765         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28766         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28767         return ret_conv;
28768 }
28769
28770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28771         if (!ptr_is_owned(_res)) return;
28772         void* _res_ptr = untag_ptr(_res);
28773         CHECK_ACCESS(_res_ptr);
28774         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28775         FREE(untag_ptr(_res));
28776         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28777 }
28778
28779 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28780         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28781         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28782         return tag_ptr(ret_conv, true);
28783 }
28784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28785         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28786         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28787         return ret_conv;
28788 }
28789
28790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28791         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28792         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28793         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28794         return tag_ptr(ret_conv, true);
28795 }
28796
28797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28798         LDKTxComplete o_conv;
28799         o_conv.inner = untag_ptr(o);
28800         o_conv.is_owned = ptr_is_owned(o);
28801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28802         o_conv = TxComplete_clone(&o_conv);
28803         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28804         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28805         return tag_ptr(ret_conv, true);
28806 }
28807
28808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28809         void* e_ptr = untag_ptr(e);
28810         CHECK_ACCESS(e_ptr);
28811         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28812         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28813         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28814         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28815         return tag_ptr(ret_conv, true);
28816 }
28817
28818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28819         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28820         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28821         return ret_conv;
28822 }
28823
28824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28825         if (!ptr_is_owned(_res)) return;
28826         void* _res_ptr = untag_ptr(_res);
28827         CHECK_ACCESS(_res_ptr);
28828         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28829         FREE(untag_ptr(_res));
28830         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28831 }
28832
28833 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28834         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28835         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28836         return tag_ptr(ret_conv, true);
28837 }
28838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28839         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28840         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28841         return ret_conv;
28842 }
28843
28844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28845         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28846         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28847         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28848         return tag_ptr(ret_conv, true);
28849 }
28850
28851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28852         LDKTxSignatures o_conv;
28853         o_conv.inner = untag_ptr(o);
28854         o_conv.is_owned = ptr_is_owned(o);
28855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28856         o_conv = TxSignatures_clone(&o_conv);
28857         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28858         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28859         return tag_ptr(ret_conv, true);
28860 }
28861
28862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28863         void* e_ptr = untag_ptr(e);
28864         CHECK_ACCESS(e_ptr);
28865         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28866         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28867         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28868         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28869         return tag_ptr(ret_conv, true);
28870 }
28871
28872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28873         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28874         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28875         return ret_conv;
28876 }
28877
28878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28879         if (!ptr_is_owned(_res)) return;
28880         void* _res_ptr = untag_ptr(_res);
28881         CHECK_ACCESS(_res_ptr);
28882         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28883         FREE(untag_ptr(_res));
28884         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28885 }
28886
28887 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28888         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28889         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28890         return tag_ptr(ret_conv, true);
28891 }
28892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28893         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28894         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28895         return ret_conv;
28896 }
28897
28898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28899         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28900         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28901         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28902         return tag_ptr(ret_conv, true);
28903 }
28904
28905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28906         LDKTxInitRbf o_conv;
28907         o_conv.inner = untag_ptr(o);
28908         o_conv.is_owned = ptr_is_owned(o);
28909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28910         o_conv = TxInitRbf_clone(&o_conv);
28911         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28912         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28913         return tag_ptr(ret_conv, true);
28914 }
28915
28916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28917         void* e_ptr = untag_ptr(e);
28918         CHECK_ACCESS(e_ptr);
28919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28921         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28922         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28923         return tag_ptr(ret_conv, true);
28924 }
28925
28926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28927         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28928         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28929         return ret_conv;
28930 }
28931
28932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28933         if (!ptr_is_owned(_res)) return;
28934         void* _res_ptr = untag_ptr(_res);
28935         CHECK_ACCESS(_res_ptr);
28936         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28937         FREE(untag_ptr(_res));
28938         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28939 }
28940
28941 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28942         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28943         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28944         return tag_ptr(ret_conv, true);
28945 }
28946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28947         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28948         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28949         return ret_conv;
28950 }
28951
28952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28953         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28954         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28955         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28956         return tag_ptr(ret_conv, true);
28957 }
28958
28959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28960         LDKTxAckRbf o_conv;
28961         o_conv.inner = untag_ptr(o);
28962         o_conv.is_owned = ptr_is_owned(o);
28963         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28964         o_conv = TxAckRbf_clone(&o_conv);
28965         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28966         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28967         return tag_ptr(ret_conv, true);
28968 }
28969
28970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28971         void* e_ptr = untag_ptr(e);
28972         CHECK_ACCESS(e_ptr);
28973         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28974         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28975         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28976         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28977         return tag_ptr(ret_conv, true);
28978 }
28979
28980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28981         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28982         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28983         return ret_conv;
28984 }
28985
28986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28987         if (!ptr_is_owned(_res)) return;
28988         void* _res_ptr = untag_ptr(_res);
28989         CHECK_ACCESS(_res_ptr);
28990         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28991         FREE(untag_ptr(_res));
28992         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28993 }
28994
28995 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
28996         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28997         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
28998         return tag_ptr(ret_conv, true);
28999 }
29000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29001         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
29002         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
29003         return ret_conv;
29004 }
29005
29006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29007         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
29008         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29009         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
29010         return tag_ptr(ret_conv, true);
29011 }
29012
29013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29014         LDKTxAbort o_conv;
29015         o_conv.inner = untag_ptr(o);
29016         o_conv.is_owned = ptr_is_owned(o);
29017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29018         o_conv = TxAbort_clone(&o_conv);
29019         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29020         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
29021         return tag_ptr(ret_conv, true);
29022 }
29023
29024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29025         void* e_ptr = untag_ptr(e);
29026         CHECK_ACCESS(e_ptr);
29027         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29028         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29029         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29030         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
29031         return tag_ptr(ret_conv, true);
29032 }
29033
29034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29035         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
29036         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
29037         return ret_conv;
29038 }
29039
29040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29041         if (!ptr_is_owned(_res)) return;
29042         void* _res_ptr = untag_ptr(_res);
29043         CHECK_ACCESS(_res_ptr);
29044         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
29045         FREE(untag_ptr(_res));
29046         CResult_TxAbortDecodeErrorZ_free(_res_conv);
29047 }
29048
29049 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
29050         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29051         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
29052         return tag_ptr(ret_conv, true);
29053 }
29054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29055         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
29056         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
29057         return ret_conv;
29058 }
29059
29060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29061         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
29062         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29063         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
29064         return tag_ptr(ret_conv, true);
29065 }
29066
29067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29068         LDKAnnouncementSignatures o_conv;
29069         o_conv.inner = untag_ptr(o);
29070         o_conv.is_owned = ptr_is_owned(o);
29071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29072         o_conv = AnnouncementSignatures_clone(&o_conv);
29073         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29074         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
29075         return tag_ptr(ret_conv, true);
29076 }
29077
29078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29079         void* e_ptr = untag_ptr(e);
29080         CHECK_ACCESS(e_ptr);
29081         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29082         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29083         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29084         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
29085         return tag_ptr(ret_conv, true);
29086 }
29087
29088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29089         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
29090         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
29091         return ret_conv;
29092 }
29093
29094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29095         if (!ptr_is_owned(_res)) return;
29096         void* _res_ptr = untag_ptr(_res);
29097         CHECK_ACCESS(_res_ptr);
29098         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
29099         FREE(untag_ptr(_res));
29100         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
29101 }
29102
29103 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
29104         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29105         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
29106         return tag_ptr(ret_conv, true);
29107 }
29108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29109         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
29110         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
29111         return ret_conv;
29112 }
29113
29114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29115         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
29116         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29117         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
29118         return tag_ptr(ret_conv, true);
29119 }
29120
29121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29122         LDKChannelReestablish o_conv;
29123         o_conv.inner = untag_ptr(o);
29124         o_conv.is_owned = ptr_is_owned(o);
29125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29126         o_conv = ChannelReestablish_clone(&o_conv);
29127         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29128         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
29129         return tag_ptr(ret_conv, true);
29130 }
29131
29132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29133         void* e_ptr = untag_ptr(e);
29134         CHECK_ACCESS(e_ptr);
29135         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29136         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29137         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29138         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
29139         return tag_ptr(ret_conv, true);
29140 }
29141
29142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29143         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
29144         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
29145         return ret_conv;
29146 }
29147
29148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29149         if (!ptr_is_owned(_res)) return;
29150         void* _res_ptr = untag_ptr(_res);
29151         CHECK_ACCESS(_res_ptr);
29152         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
29153         FREE(untag_ptr(_res));
29154         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
29155 }
29156
29157 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
29158         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29159         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
29160         return tag_ptr(ret_conv, true);
29161 }
29162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29163         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
29164         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
29165         return ret_conv;
29166 }
29167
29168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29169         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
29170         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29171         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
29172         return tag_ptr(ret_conv, true);
29173 }
29174
29175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29176         LDKClosingSigned o_conv;
29177         o_conv.inner = untag_ptr(o);
29178         o_conv.is_owned = ptr_is_owned(o);
29179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29180         o_conv = ClosingSigned_clone(&o_conv);
29181         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29182         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
29183         return tag_ptr(ret_conv, true);
29184 }
29185
29186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29187         void* e_ptr = untag_ptr(e);
29188         CHECK_ACCESS(e_ptr);
29189         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29190         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29191         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29192         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
29193         return tag_ptr(ret_conv, true);
29194 }
29195
29196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29197         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
29198         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
29199         return ret_conv;
29200 }
29201
29202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29203         if (!ptr_is_owned(_res)) return;
29204         void* _res_ptr = untag_ptr(_res);
29205         CHECK_ACCESS(_res_ptr);
29206         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
29207         FREE(untag_ptr(_res));
29208         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
29209 }
29210
29211 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
29212         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29213         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
29214         return tag_ptr(ret_conv, true);
29215 }
29216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29217         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
29218         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
29219         return ret_conv;
29220 }
29221
29222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29223         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
29224         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29225         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
29226         return tag_ptr(ret_conv, true);
29227 }
29228
29229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29230         LDKClosingSignedFeeRange o_conv;
29231         o_conv.inner = untag_ptr(o);
29232         o_conv.is_owned = ptr_is_owned(o);
29233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29234         o_conv = ClosingSignedFeeRange_clone(&o_conv);
29235         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29236         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
29237         return tag_ptr(ret_conv, true);
29238 }
29239
29240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29241         void* e_ptr = untag_ptr(e);
29242         CHECK_ACCESS(e_ptr);
29243         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29244         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29245         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29246         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
29247         return tag_ptr(ret_conv, true);
29248 }
29249
29250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29251         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
29252         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
29253         return ret_conv;
29254 }
29255
29256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29257         if (!ptr_is_owned(_res)) return;
29258         void* _res_ptr = untag_ptr(_res);
29259         CHECK_ACCESS(_res_ptr);
29260         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
29261         FREE(untag_ptr(_res));
29262         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
29263 }
29264
29265 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
29266         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29267         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
29268         return tag_ptr(ret_conv, true);
29269 }
29270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29271         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
29272         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
29273         return ret_conv;
29274 }
29275
29276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29277         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
29278         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29279         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
29280         return tag_ptr(ret_conv, true);
29281 }
29282
29283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29284         LDKCommitmentSigned o_conv;
29285         o_conv.inner = untag_ptr(o);
29286         o_conv.is_owned = ptr_is_owned(o);
29287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29288         o_conv = CommitmentSigned_clone(&o_conv);
29289         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29290         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
29291         return tag_ptr(ret_conv, true);
29292 }
29293
29294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29295         void* e_ptr = untag_ptr(e);
29296         CHECK_ACCESS(e_ptr);
29297         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29298         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29299         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29300         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
29301         return tag_ptr(ret_conv, true);
29302 }
29303
29304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29305         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
29306         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
29307         return ret_conv;
29308 }
29309
29310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29311         if (!ptr_is_owned(_res)) return;
29312         void* _res_ptr = untag_ptr(_res);
29313         CHECK_ACCESS(_res_ptr);
29314         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
29315         FREE(untag_ptr(_res));
29316         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
29317 }
29318
29319 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
29320         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29321         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
29322         return tag_ptr(ret_conv, true);
29323 }
29324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29325         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
29326         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
29327         return ret_conv;
29328 }
29329
29330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29331         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
29332         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29333         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
29334         return tag_ptr(ret_conv, true);
29335 }
29336
29337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29338         LDKFundingCreated o_conv;
29339         o_conv.inner = untag_ptr(o);
29340         o_conv.is_owned = ptr_is_owned(o);
29341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29342         o_conv = FundingCreated_clone(&o_conv);
29343         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29344         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
29345         return tag_ptr(ret_conv, true);
29346 }
29347
29348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29349         void* e_ptr = untag_ptr(e);
29350         CHECK_ACCESS(e_ptr);
29351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29353         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29354         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
29355         return tag_ptr(ret_conv, true);
29356 }
29357
29358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29359         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
29360         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
29361         return ret_conv;
29362 }
29363
29364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29365         if (!ptr_is_owned(_res)) return;
29366         void* _res_ptr = untag_ptr(_res);
29367         CHECK_ACCESS(_res_ptr);
29368         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
29369         FREE(untag_ptr(_res));
29370         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
29371 }
29372
29373 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
29374         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29375         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
29376         return tag_ptr(ret_conv, true);
29377 }
29378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29379         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
29380         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
29381         return ret_conv;
29382 }
29383
29384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29385         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
29386         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29387         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
29388         return tag_ptr(ret_conv, true);
29389 }
29390
29391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29392         LDKFundingSigned o_conv;
29393         o_conv.inner = untag_ptr(o);
29394         o_conv.is_owned = ptr_is_owned(o);
29395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29396         o_conv = FundingSigned_clone(&o_conv);
29397         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29398         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
29399         return tag_ptr(ret_conv, true);
29400 }
29401
29402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29403         void* e_ptr = untag_ptr(e);
29404         CHECK_ACCESS(e_ptr);
29405         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29406         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29407         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29408         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
29409         return tag_ptr(ret_conv, true);
29410 }
29411
29412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29413         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
29414         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
29415         return ret_conv;
29416 }
29417
29418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29419         if (!ptr_is_owned(_res)) return;
29420         void* _res_ptr = untag_ptr(_res);
29421         CHECK_ACCESS(_res_ptr);
29422         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
29423         FREE(untag_ptr(_res));
29424         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
29425 }
29426
29427 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
29428         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29429         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
29430         return tag_ptr(ret_conv, true);
29431 }
29432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29433         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
29434         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
29435         return ret_conv;
29436 }
29437
29438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29439         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
29440         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29441         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
29442         return tag_ptr(ret_conv, true);
29443 }
29444
29445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29446         LDKChannelReady o_conv;
29447         o_conv.inner = untag_ptr(o);
29448         o_conv.is_owned = ptr_is_owned(o);
29449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29450         o_conv = ChannelReady_clone(&o_conv);
29451         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29452         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
29453         return tag_ptr(ret_conv, true);
29454 }
29455
29456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29457         void* e_ptr = untag_ptr(e);
29458         CHECK_ACCESS(e_ptr);
29459         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29460         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29461         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29462         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
29463         return tag_ptr(ret_conv, true);
29464 }
29465
29466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29467         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
29468         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
29469         return ret_conv;
29470 }
29471
29472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29473         if (!ptr_is_owned(_res)) return;
29474         void* _res_ptr = untag_ptr(_res);
29475         CHECK_ACCESS(_res_ptr);
29476         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
29477         FREE(untag_ptr(_res));
29478         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
29479 }
29480
29481 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
29482         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29483         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
29484         return tag_ptr(ret_conv, true);
29485 }
29486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29487         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
29488         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
29489         return ret_conv;
29490 }
29491
29492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29493         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
29494         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29495         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
29496         return tag_ptr(ret_conv, true);
29497 }
29498
29499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29500         LDKInit o_conv;
29501         o_conv.inner = untag_ptr(o);
29502         o_conv.is_owned = ptr_is_owned(o);
29503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29504         o_conv = Init_clone(&o_conv);
29505         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29506         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
29507         return tag_ptr(ret_conv, true);
29508 }
29509
29510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29511         void* e_ptr = untag_ptr(e);
29512         CHECK_ACCESS(e_ptr);
29513         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29514         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29515         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29516         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
29517         return tag_ptr(ret_conv, true);
29518 }
29519
29520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29521         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
29522         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
29523         return ret_conv;
29524 }
29525
29526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29527         if (!ptr_is_owned(_res)) return;
29528         void* _res_ptr = untag_ptr(_res);
29529         CHECK_ACCESS(_res_ptr);
29530         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
29531         FREE(untag_ptr(_res));
29532         CResult_InitDecodeErrorZ_free(_res_conv);
29533 }
29534
29535 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
29536         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29537         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
29538         return tag_ptr(ret_conv, true);
29539 }
29540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29541         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
29542         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
29543         return ret_conv;
29544 }
29545
29546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29547         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
29548         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29549         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
29550         return tag_ptr(ret_conv, true);
29551 }
29552
29553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29554         LDKOpenChannel o_conv;
29555         o_conv.inner = untag_ptr(o);
29556         o_conv.is_owned = ptr_is_owned(o);
29557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29558         o_conv = OpenChannel_clone(&o_conv);
29559         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29560         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
29561         return tag_ptr(ret_conv, true);
29562 }
29563
29564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29565         void* e_ptr = untag_ptr(e);
29566         CHECK_ACCESS(e_ptr);
29567         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29568         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29569         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29570         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
29571         return tag_ptr(ret_conv, true);
29572 }
29573
29574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29575         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
29576         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
29577         return ret_conv;
29578 }
29579
29580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29581         if (!ptr_is_owned(_res)) return;
29582         void* _res_ptr = untag_ptr(_res);
29583         CHECK_ACCESS(_res_ptr);
29584         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29585         FREE(untag_ptr(_res));
29586         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29587 }
29588
29589 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29590         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29591         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29592         return tag_ptr(ret_conv, true);
29593 }
29594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29595         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29596         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29597         return ret_conv;
29598 }
29599
29600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29601         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29602         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29603         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29604         return tag_ptr(ret_conv, true);
29605 }
29606
29607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29608         LDKOpenChannelV2 o_conv;
29609         o_conv.inner = untag_ptr(o);
29610         o_conv.is_owned = ptr_is_owned(o);
29611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29612         o_conv = OpenChannelV2_clone(&o_conv);
29613         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29614         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29615         return tag_ptr(ret_conv, true);
29616 }
29617
29618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29619         void* e_ptr = untag_ptr(e);
29620         CHECK_ACCESS(e_ptr);
29621         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29622         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29623         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29624         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29625         return tag_ptr(ret_conv, true);
29626 }
29627
29628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29629         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29630         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29631         return ret_conv;
29632 }
29633
29634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29635         if (!ptr_is_owned(_res)) return;
29636         void* _res_ptr = untag_ptr(_res);
29637         CHECK_ACCESS(_res_ptr);
29638         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29639         FREE(untag_ptr(_res));
29640         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29641 }
29642
29643 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29644         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29645         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29646         return tag_ptr(ret_conv, true);
29647 }
29648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29649         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29650         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29651         return ret_conv;
29652 }
29653
29654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29655         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29656         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29657         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29658         return tag_ptr(ret_conv, true);
29659 }
29660
29661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29662         LDKRevokeAndACK o_conv;
29663         o_conv.inner = untag_ptr(o);
29664         o_conv.is_owned = ptr_is_owned(o);
29665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29666         o_conv = RevokeAndACK_clone(&o_conv);
29667         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29668         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29669         return tag_ptr(ret_conv, true);
29670 }
29671
29672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29673         void* e_ptr = untag_ptr(e);
29674         CHECK_ACCESS(e_ptr);
29675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29677         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29678         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29679         return tag_ptr(ret_conv, true);
29680 }
29681
29682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29683         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29684         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29685         return ret_conv;
29686 }
29687
29688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29689         if (!ptr_is_owned(_res)) return;
29690         void* _res_ptr = untag_ptr(_res);
29691         CHECK_ACCESS(_res_ptr);
29692         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29693         FREE(untag_ptr(_res));
29694         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29695 }
29696
29697 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29698         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29699         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29700         return tag_ptr(ret_conv, true);
29701 }
29702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29703         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29704         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29705         return ret_conv;
29706 }
29707
29708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29709         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29710         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29711         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29712         return tag_ptr(ret_conv, true);
29713 }
29714
29715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29716         LDKShutdown o_conv;
29717         o_conv.inner = untag_ptr(o);
29718         o_conv.is_owned = ptr_is_owned(o);
29719         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29720         o_conv = Shutdown_clone(&o_conv);
29721         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29722         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29723         return tag_ptr(ret_conv, true);
29724 }
29725
29726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29727         void* e_ptr = untag_ptr(e);
29728         CHECK_ACCESS(e_ptr);
29729         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29730         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29731         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29732         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29733         return tag_ptr(ret_conv, true);
29734 }
29735
29736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29737         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29738         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29739         return ret_conv;
29740 }
29741
29742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29743         if (!ptr_is_owned(_res)) return;
29744         void* _res_ptr = untag_ptr(_res);
29745         CHECK_ACCESS(_res_ptr);
29746         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29747         FREE(untag_ptr(_res));
29748         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29749 }
29750
29751 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29752         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29753         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29754         return tag_ptr(ret_conv, true);
29755 }
29756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29757         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29758         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29759         return ret_conv;
29760 }
29761
29762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29763         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29764         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29765         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29766         return tag_ptr(ret_conv, true);
29767 }
29768
29769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29770         LDKUpdateFailHTLC o_conv;
29771         o_conv.inner = untag_ptr(o);
29772         o_conv.is_owned = ptr_is_owned(o);
29773         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29774         o_conv = UpdateFailHTLC_clone(&o_conv);
29775         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29776         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29777         return tag_ptr(ret_conv, true);
29778 }
29779
29780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29781         void* e_ptr = untag_ptr(e);
29782         CHECK_ACCESS(e_ptr);
29783         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29784         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29785         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29786         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29787         return tag_ptr(ret_conv, true);
29788 }
29789
29790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29791         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29792         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29793         return ret_conv;
29794 }
29795
29796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29797         if (!ptr_is_owned(_res)) return;
29798         void* _res_ptr = untag_ptr(_res);
29799         CHECK_ACCESS(_res_ptr);
29800         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29801         FREE(untag_ptr(_res));
29802         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29803 }
29804
29805 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29806         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29807         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29808         return tag_ptr(ret_conv, true);
29809 }
29810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29811         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29812         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29813         return ret_conv;
29814 }
29815
29816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29817         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29818         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29819         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29820         return tag_ptr(ret_conv, true);
29821 }
29822
29823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29824         LDKUpdateFailMalformedHTLC o_conv;
29825         o_conv.inner = untag_ptr(o);
29826         o_conv.is_owned = ptr_is_owned(o);
29827         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29828         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29829         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29830         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29831         return tag_ptr(ret_conv, true);
29832 }
29833
29834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29835         void* e_ptr = untag_ptr(e);
29836         CHECK_ACCESS(e_ptr);
29837         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29838         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29839         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29840         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29841         return tag_ptr(ret_conv, true);
29842 }
29843
29844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29845         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29846         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29847         return ret_conv;
29848 }
29849
29850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29851         if (!ptr_is_owned(_res)) return;
29852         void* _res_ptr = untag_ptr(_res);
29853         CHECK_ACCESS(_res_ptr);
29854         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29855         FREE(untag_ptr(_res));
29856         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29857 }
29858
29859 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29860         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29861         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29862         return tag_ptr(ret_conv, true);
29863 }
29864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29865         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29866         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29867         return ret_conv;
29868 }
29869
29870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29871         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29872         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29873         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29874         return tag_ptr(ret_conv, true);
29875 }
29876
29877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29878         LDKUpdateFee o_conv;
29879         o_conv.inner = untag_ptr(o);
29880         o_conv.is_owned = ptr_is_owned(o);
29881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29882         o_conv = UpdateFee_clone(&o_conv);
29883         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29884         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29885         return tag_ptr(ret_conv, true);
29886 }
29887
29888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29889         void* e_ptr = untag_ptr(e);
29890         CHECK_ACCESS(e_ptr);
29891         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29892         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29893         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29894         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29895         return tag_ptr(ret_conv, true);
29896 }
29897
29898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29899         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29900         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29901         return ret_conv;
29902 }
29903
29904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29905         if (!ptr_is_owned(_res)) return;
29906         void* _res_ptr = untag_ptr(_res);
29907         CHECK_ACCESS(_res_ptr);
29908         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29909         FREE(untag_ptr(_res));
29910         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29911 }
29912
29913 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29914         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29915         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29916         return tag_ptr(ret_conv, true);
29917 }
29918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29919         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29920         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29921         return ret_conv;
29922 }
29923
29924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29925         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29926         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29927         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29928         return tag_ptr(ret_conv, true);
29929 }
29930
29931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29932         LDKUpdateFulfillHTLC o_conv;
29933         o_conv.inner = untag_ptr(o);
29934         o_conv.is_owned = ptr_is_owned(o);
29935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29936         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29937         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29938         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29939         return tag_ptr(ret_conv, true);
29940 }
29941
29942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29943         void* e_ptr = untag_ptr(e);
29944         CHECK_ACCESS(e_ptr);
29945         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29946         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29947         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29948         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29949         return tag_ptr(ret_conv, true);
29950 }
29951
29952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29953         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29954         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29955         return ret_conv;
29956 }
29957
29958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29959         if (!ptr_is_owned(_res)) return;
29960         void* _res_ptr = untag_ptr(_res);
29961         CHECK_ACCESS(_res_ptr);
29962         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29963         FREE(untag_ptr(_res));
29964         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29965 }
29966
29967 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29968         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29969         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29970         return tag_ptr(ret_conv, true);
29971 }
29972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29973         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29974         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29975         return ret_conv;
29976 }
29977
29978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29979         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29980         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29981         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29982         return tag_ptr(ret_conv, true);
29983 }
29984
29985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29986         LDKUpdateAddHTLC o_conv;
29987         o_conv.inner = untag_ptr(o);
29988         o_conv.is_owned = ptr_is_owned(o);
29989         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29990         o_conv = UpdateAddHTLC_clone(&o_conv);
29991         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29992         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29993         return tag_ptr(ret_conv, true);
29994 }
29995
29996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29997         void* e_ptr = untag_ptr(e);
29998         CHECK_ACCESS(e_ptr);
29999         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30000         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30001         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30002         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
30003         return tag_ptr(ret_conv, true);
30004 }
30005
30006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30007         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
30008         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
30009         return ret_conv;
30010 }
30011
30012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30013         if (!ptr_is_owned(_res)) return;
30014         void* _res_ptr = untag_ptr(_res);
30015         CHECK_ACCESS(_res_ptr);
30016         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
30017         FREE(untag_ptr(_res));
30018         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
30019 }
30020
30021 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
30022         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30023         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
30024         return tag_ptr(ret_conv, true);
30025 }
30026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30027         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
30028         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
30029         return ret_conv;
30030 }
30031
30032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30033         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
30034         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30035         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
30036         return tag_ptr(ret_conv, true);
30037 }
30038
30039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30040         LDKOnionMessage o_conv;
30041         o_conv.inner = untag_ptr(o);
30042         o_conv.is_owned = ptr_is_owned(o);
30043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30044         o_conv = OnionMessage_clone(&o_conv);
30045         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30046         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
30047         return tag_ptr(ret_conv, true);
30048 }
30049
30050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30051         void* e_ptr = untag_ptr(e);
30052         CHECK_ACCESS(e_ptr);
30053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30055         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30056         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
30057         return tag_ptr(ret_conv, true);
30058 }
30059
30060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30061         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
30062         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
30063         return ret_conv;
30064 }
30065
30066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30067         if (!ptr_is_owned(_res)) return;
30068         void* _res_ptr = untag_ptr(_res);
30069         CHECK_ACCESS(_res_ptr);
30070         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
30071         FREE(untag_ptr(_res));
30072         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
30073 }
30074
30075 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
30076         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30077         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
30078         return tag_ptr(ret_conv, true);
30079 }
30080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30081         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
30082         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
30083         return ret_conv;
30084 }
30085
30086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30087         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
30088         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30089         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
30090         return tag_ptr(ret_conv, true);
30091 }
30092
30093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30094         LDKPing o_conv;
30095         o_conv.inner = untag_ptr(o);
30096         o_conv.is_owned = ptr_is_owned(o);
30097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30098         o_conv = Ping_clone(&o_conv);
30099         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30100         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
30101         return tag_ptr(ret_conv, true);
30102 }
30103
30104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30105         void* e_ptr = untag_ptr(e);
30106         CHECK_ACCESS(e_ptr);
30107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30109         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30110         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
30111         return tag_ptr(ret_conv, true);
30112 }
30113
30114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30115         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
30116         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
30117         return ret_conv;
30118 }
30119
30120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30121         if (!ptr_is_owned(_res)) return;
30122         void* _res_ptr = untag_ptr(_res);
30123         CHECK_ACCESS(_res_ptr);
30124         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
30125         FREE(untag_ptr(_res));
30126         CResult_PingDecodeErrorZ_free(_res_conv);
30127 }
30128
30129 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
30130         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30131         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
30132         return tag_ptr(ret_conv, true);
30133 }
30134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30135         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
30136         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
30137         return ret_conv;
30138 }
30139
30140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30141         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
30142         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30143         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
30144         return tag_ptr(ret_conv, true);
30145 }
30146
30147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30148         LDKPong o_conv;
30149         o_conv.inner = untag_ptr(o);
30150         o_conv.is_owned = ptr_is_owned(o);
30151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30152         o_conv = Pong_clone(&o_conv);
30153         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30154         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
30155         return tag_ptr(ret_conv, true);
30156 }
30157
30158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30159         void* e_ptr = untag_ptr(e);
30160         CHECK_ACCESS(e_ptr);
30161         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30162         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30163         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30164         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
30165         return tag_ptr(ret_conv, true);
30166 }
30167
30168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30169         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
30170         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
30171         return ret_conv;
30172 }
30173
30174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30175         if (!ptr_is_owned(_res)) return;
30176         void* _res_ptr = untag_ptr(_res);
30177         CHECK_ACCESS(_res_ptr);
30178         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
30179         FREE(untag_ptr(_res));
30180         CResult_PongDecodeErrorZ_free(_res_conv);
30181 }
30182
30183 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
30184         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30185         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
30186         return tag_ptr(ret_conv, true);
30187 }
30188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30189         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
30190         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
30191         return ret_conv;
30192 }
30193
30194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30195         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
30196         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30197         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
30198         return tag_ptr(ret_conv, true);
30199 }
30200
30201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30202         LDKUnsignedChannelAnnouncement o_conv;
30203         o_conv.inner = untag_ptr(o);
30204         o_conv.is_owned = ptr_is_owned(o);
30205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30206         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
30207         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30208         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
30209         return tag_ptr(ret_conv, true);
30210 }
30211
30212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30213         void* e_ptr = untag_ptr(e);
30214         CHECK_ACCESS(e_ptr);
30215         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30216         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30217         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30218         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
30219         return tag_ptr(ret_conv, true);
30220 }
30221
30222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30223         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30224         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30225         return ret_conv;
30226 }
30227
30228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30229         if (!ptr_is_owned(_res)) return;
30230         void* _res_ptr = untag_ptr(_res);
30231         CHECK_ACCESS(_res_ptr);
30232         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30233         FREE(untag_ptr(_res));
30234         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
30235 }
30236
30237 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30238         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30239         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
30240         return tag_ptr(ret_conv, true);
30241 }
30242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30243         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30244         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30245         return ret_conv;
30246 }
30247
30248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30249         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30250         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30251         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30252         return tag_ptr(ret_conv, true);
30253 }
30254
30255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30256         LDKChannelAnnouncement o_conv;
30257         o_conv.inner = untag_ptr(o);
30258         o_conv.is_owned = ptr_is_owned(o);
30259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30260         o_conv = ChannelAnnouncement_clone(&o_conv);
30261         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30262         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
30263         return tag_ptr(ret_conv, true);
30264 }
30265
30266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30267         void* e_ptr = untag_ptr(e);
30268         CHECK_ACCESS(e_ptr);
30269         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30270         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30271         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30272         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
30273         return tag_ptr(ret_conv, true);
30274 }
30275
30276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30277         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30278         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30279         return ret_conv;
30280 }
30281
30282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30283         if (!ptr_is_owned(_res)) return;
30284         void* _res_ptr = untag_ptr(_res);
30285         CHECK_ACCESS(_res_ptr);
30286         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30287         FREE(untag_ptr(_res));
30288         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
30289 }
30290
30291 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30292         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30293         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
30294         return tag_ptr(ret_conv, true);
30295 }
30296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30297         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30298         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30299         return ret_conv;
30300 }
30301
30302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30303         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30304         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30305         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30306         return tag_ptr(ret_conv, true);
30307 }
30308
30309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30310         LDKUnsignedChannelUpdate o_conv;
30311         o_conv.inner = untag_ptr(o);
30312         o_conv.is_owned = ptr_is_owned(o);
30313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30314         o_conv = UnsignedChannelUpdate_clone(&o_conv);
30315         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30316         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
30317         return tag_ptr(ret_conv, true);
30318 }
30319
30320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30321         void* e_ptr = untag_ptr(e);
30322         CHECK_ACCESS(e_ptr);
30323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30325         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30326         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
30327         return tag_ptr(ret_conv, true);
30328 }
30329
30330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30331         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
30332         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
30333         return ret_conv;
30334 }
30335
30336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30337         if (!ptr_is_owned(_res)) return;
30338         void* _res_ptr = untag_ptr(_res);
30339         CHECK_ACCESS(_res_ptr);
30340         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
30341         FREE(untag_ptr(_res));
30342         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
30343 }
30344
30345 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30346         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30347         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
30348         return tag_ptr(ret_conv, true);
30349 }
30350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30351         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30352         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30353         return ret_conv;
30354 }
30355
30356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30357         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30358         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30359         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
30360         return tag_ptr(ret_conv, true);
30361 }
30362
30363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30364         LDKChannelUpdate o_conv;
30365         o_conv.inner = untag_ptr(o);
30366         o_conv.is_owned = ptr_is_owned(o);
30367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30368         o_conv = ChannelUpdate_clone(&o_conv);
30369         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30370         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
30371         return tag_ptr(ret_conv, true);
30372 }
30373
30374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30375         void* e_ptr = untag_ptr(e);
30376         CHECK_ACCESS(e_ptr);
30377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30379         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30380         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
30381         return tag_ptr(ret_conv, true);
30382 }
30383
30384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30385         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
30386         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
30387         return ret_conv;
30388 }
30389
30390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30391         if (!ptr_is_owned(_res)) return;
30392         void* _res_ptr = untag_ptr(_res);
30393         CHECK_ACCESS(_res_ptr);
30394         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
30395         FREE(untag_ptr(_res));
30396         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30397 }
30398
30399 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30400         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30401         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30402         return tag_ptr(ret_conv, true);
30403 }
30404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30405         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30406         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30407         return ret_conv;
30408 }
30409
30410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30411         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30412         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30413         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30414         return tag_ptr(ret_conv, true);
30415 }
30416
30417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30418         LDKErrorMessage o_conv;
30419         o_conv.inner = untag_ptr(o);
30420         o_conv.is_owned = ptr_is_owned(o);
30421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30422         o_conv = ErrorMessage_clone(&o_conv);
30423         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30424         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30425         return tag_ptr(ret_conv, true);
30426 }
30427
30428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30429         void* e_ptr = untag_ptr(e);
30430         CHECK_ACCESS(e_ptr);
30431         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30432         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30433         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30434         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30435         return tag_ptr(ret_conv, true);
30436 }
30437
30438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30439         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30440         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30441         return ret_conv;
30442 }
30443
30444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30445         if (!ptr_is_owned(_res)) return;
30446         void* _res_ptr = untag_ptr(_res);
30447         CHECK_ACCESS(_res_ptr);
30448         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30449         FREE(untag_ptr(_res));
30450         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30451 }
30452
30453 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30454         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30455         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30456         return tag_ptr(ret_conv, true);
30457 }
30458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30459         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30460         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30461         return ret_conv;
30462 }
30463
30464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30465         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30466         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30467         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30468         return tag_ptr(ret_conv, true);
30469 }
30470
30471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30472         LDKWarningMessage o_conv;
30473         o_conv.inner = untag_ptr(o);
30474         o_conv.is_owned = ptr_is_owned(o);
30475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30476         o_conv = WarningMessage_clone(&o_conv);
30477         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30478         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30479         return tag_ptr(ret_conv, true);
30480 }
30481
30482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30483         void* e_ptr = untag_ptr(e);
30484         CHECK_ACCESS(e_ptr);
30485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30487         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30488         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30489         return tag_ptr(ret_conv, true);
30490 }
30491
30492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30493         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30494         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30495         return ret_conv;
30496 }
30497
30498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30499         if (!ptr_is_owned(_res)) return;
30500         void* _res_ptr = untag_ptr(_res);
30501         CHECK_ACCESS(_res_ptr);
30502         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30503         FREE(untag_ptr(_res));
30504         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30505 }
30506
30507 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30508         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30509         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30510         return tag_ptr(ret_conv, true);
30511 }
30512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30513         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30514         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30515         return ret_conv;
30516 }
30517
30518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30519         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30520         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30521         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30522         return tag_ptr(ret_conv, true);
30523 }
30524
30525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30526         LDKUnsignedNodeAnnouncement o_conv;
30527         o_conv.inner = untag_ptr(o);
30528         o_conv.is_owned = ptr_is_owned(o);
30529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30530         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30531         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30532         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30533         return tag_ptr(ret_conv, true);
30534 }
30535
30536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30537         void* e_ptr = untag_ptr(e);
30538         CHECK_ACCESS(e_ptr);
30539         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30540         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30541         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30542         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30543         return tag_ptr(ret_conv, true);
30544 }
30545
30546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30547         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30548         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30549         return ret_conv;
30550 }
30551
30552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30553         if (!ptr_is_owned(_res)) return;
30554         void* _res_ptr = untag_ptr(_res);
30555         CHECK_ACCESS(_res_ptr);
30556         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30557         FREE(untag_ptr(_res));
30558         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30559 }
30560
30561 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30562         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30563         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30564         return tag_ptr(ret_conv, true);
30565 }
30566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30567         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30568         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30569         return ret_conv;
30570 }
30571
30572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30573         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30574         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30575         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30576         return tag_ptr(ret_conv, true);
30577 }
30578
30579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30580         LDKNodeAnnouncement o_conv;
30581         o_conv.inner = untag_ptr(o);
30582         o_conv.is_owned = ptr_is_owned(o);
30583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30584         o_conv = NodeAnnouncement_clone(&o_conv);
30585         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30586         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30587         return tag_ptr(ret_conv, true);
30588 }
30589
30590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30591         void* e_ptr = untag_ptr(e);
30592         CHECK_ACCESS(e_ptr);
30593         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30594         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30595         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30596         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30597         return tag_ptr(ret_conv, true);
30598 }
30599
30600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30601         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30602         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30603         return ret_conv;
30604 }
30605
30606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30607         if (!ptr_is_owned(_res)) return;
30608         void* _res_ptr = untag_ptr(_res);
30609         CHECK_ACCESS(_res_ptr);
30610         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30611         FREE(untag_ptr(_res));
30612         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30613 }
30614
30615 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30616         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30617         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30618         return tag_ptr(ret_conv, true);
30619 }
30620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30621         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30622         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30623         return ret_conv;
30624 }
30625
30626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30627         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30628         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30629         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30630         return tag_ptr(ret_conv, true);
30631 }
30632
30633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30634         LDKQueryShortChannelIds o_conv;
30635         o_conv.inner = untag_ptr(o);
30636         o_conv.is_owned = ptr_is_owned(o);
30637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30638         o_conv = QueryShortChannelIds_clone(&o_conv);
30639         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30640         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30641         return tag_ptr(ret_conv, true);
30642 }
30643
30644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30645         void* e_ptr = untag_ptr(e);
30646         CHECK_ACCESS(e_ptr);
30647         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30648         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30649         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30650         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30651         return tag_ptr(ret_conv, true);
30652 }
30653
30654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30655         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30656         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30657         return ret_conv;
30658 }
30659
30660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30661         if (!ptr_is_owned(_res)) return;
30662         void* _res_ptr = untag_ptr(_res);
30663         CHECK_ACCESS(_res_ptr);
30664         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30665         FREE(untag_ptr(_res));
30666         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30667 }
30668
30669 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30670         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30671         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30672         return tag_ptr(ret_conv, true);
30673 }
30674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30675         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30676         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30677         return ret_conv;
30678 }
30679
30680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30681         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30682         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30683         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30684         return tag_ptr(ret_conv, true);
30685 }
30686
30687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30688         LDKReplyShortChannelIdsEnd o_conv;
30689         o_conv.inner = untag_ptr(o);
30690         o_conv.is_owned = ptr_is_owned(o);
30691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30692         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30693         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30694         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30695         return tag_ptr(ret_conv, true);
30696 }
30697
30698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30699         void* e_ptr = untag_ptr(e);
30700         CHECK_ACCESS(e_ptr);
30701         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30702         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30703         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30704         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30705         return tag_ptr(ret_conv, true);
30706 }
30707
30708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30709         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30710         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30711         return ret_conv;
30712 }
30713
30714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30715         if (!ptr_is_owned(_res)) return;
30716         void* _res_ptr = untag_ptr(_res);
30717         CHECK_ACCESS(_res_ptr);
30718         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30719         FREE(untag_ptr(_res));
30720         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30721 }
30722
30723 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30724         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30725         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30726         return tag_ptr(ret_conv, true);
30727 }
30728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30729         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30730         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30731         return ret_conv;
30732 }
30733
30734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30735         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30736         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30737         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30738         return tag_ptr(ret_conv, true);
30739 }
30740
30741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30742         LDKQueryChannelRange o_conv;
30743         o_conv.inner = untag_ptr(o);
30744         o_conv.is_owned = ptr_is_owned(o);
30745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30746         o_conv = QueryChannelRange_clone(&o_conv);
30747         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30748         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30749         return tag_ptr(ret_conv, true);
30750 }
30751
30752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30753         void* e_ptr = untag_ptr(e);
30754         CHECK_ACCESS(e_ptr);
30755         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30756         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30757         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30758         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30759         return tag_ptr(ret_conv, true);
30760 }
30761
30762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30763         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30764         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30765         return ret_conv;
30766 }
30767
30768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30769         if (!ptr_is_owned(_res)) return;
30770         void* _res_ptr = untag_ptr(_res);
30771         CHECK_ACCESS(_res_ptr);
30772         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30773         FREE(untag_ptr(_res));
30774         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30775 }
30776
30777 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30778         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30779         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30780         return tag_ptr(ret_conv, true);
30781 }
30782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30783         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30784         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30785         return ret_conv;
30786 }
30787
30788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30789         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30790         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30791         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30792         return tag_ptr(ret_conv, true);
30793 }
30794
30795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30796         LDKReplyChannelRange o_conv;
30797         o_conv.inner = untag_ptr(o);
30798         o_conv.is_owned = ptr_is_owned(o);
30799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30800         o_conv = ReplyChannelRange_clone(&o_conv);
30801         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30802         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30803         return tag_ptr(ret_conv, true);
30804 }
30805
30806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30807         void* e_ptr = untag_ptr(e);
30808         CHECK_ACCESS(e_ptr);
30809         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30810         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30811         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30812         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30813         return tag_ptr(ret_conv, true);
30814 }
30815
30816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30817         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30818         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30819         return ret_conv;
30820 }
30821
30822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30823         if (!ptr_is_owned(_res)) return;
30824         void* _res_ptr = untag_ptr(_res);
30825         CHECK_ACCESS(_res_ptr);
30826         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30827         FREE(untag_ptr(_res));
30828         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30829 }
30830
30831 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30832         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30833         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30834         return tag_ptr(ret_conv, true);
30835 }
30836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30837         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30838         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30839         return ret_conv;
30840 }
30841
30842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30843         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30844         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30845         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30846         return tag_ptr(ret_conv, true);
30847 }
30848
30849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30850         LDKGossipTimestampFilter o_conv;
30851         o_conv.inner = untag_ptr(o);
30852         o_conv.is_owned = ptr_is_owned(o);
30853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30854         o_conv = GossipTimestampFilter_clone(&o_conv);
30855         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30856         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30857         return tag_ptr(ret_conv, true);
30858 }
30859
30860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30861         void* e_ptr = untag_ptr(e);
30862         CHECK_ACCESS(e_ptr);
30863         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30864         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30865         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30866         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30867         return tag_ptr(ret_conv, true);
30868 }
30869
30870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30871         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30872         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30873         return ret_conv;
30874 }
30875
30876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30877         if (!ptr_is_owned(_res)) return;
30878         void* _res_ptr = untag_ptr(_res);
30879         CHECK_ACCESS(_res_ptr);
30880         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30881         FREE(untag_ptr(_res));
30882         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30883 }
30884
30885 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30886         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30887         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30888         return tag_ptr(ret_conv, true);
30889 }
30890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30891         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30892         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30893         return ret_conv;
30894 }
30895
30896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30897         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30898         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30899         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30900         return tag_ptr(ret_conv, true);
30901 }
30902
30903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30904         LDKCVec_PhantomRouteHintsZ _res_constr;
30905         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30906         if (_res_constr.datalen > 0)
30907                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30908         else
30909                 _res_constr.data = NULL;
30910         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30911         for (size_t t = 0; t < _res_constr.datalen; t++) {
30912                 int64_t _res_conv_19 = _res_vals[t];
30913                 LDKPhantomRouteHints _res_conv_19_conv;
30914                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30915                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30916                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30917                 _res_constr.data[t] = _res_conv_19_conv;
30918         }
30919         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30920         CVec_PhantomRouteHintsZ_free(_res_constr);
30921 }
30922
30923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30924         LDKBolt11Invoice o_conv;
30925         o_conv.inner = untag_ptr(o);
30926         o_conv.is_owned = ptr_is_owned(o);
30927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30928         o_conv = Bolt11Invoice_clone(&o_conv);
30929         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30930         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30931         return tag_ptr(ret_conv, true);
30932 }
30933
30934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30935         void* e_ptr = untag_ptr(e);
30936         CHECK_ACCESS(e_ptr);
30937         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30938         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30939         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30940         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30941         return tag_ptr(ret_conv, true);
30942 }
30943
30944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30945         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30946         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30947         return ret_conv;
30948 }
30949
30950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30951         if (!ptr_is_owned(_res)) return;
30952         void* _res_ptr = untag_ptr(_res);
30953         CHECK_ACCESS(_res_ptr);
30954         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30955         FREE(untag_ptr(_res));
30956         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30957 }
30958
30959 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30960         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30961         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30962         return tag_ptr(ret_conv, true);
30963 }
30964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30965         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30966         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30967         return ret_conv;
30968 }
30969
30970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30971         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30972         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30973         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30974         return tag_ptr(ret_conv, true);
30975 }
30976
30977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30978         LDKCVec_FutureZ _res_constr;
30979         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30980         if (_res_constr.datalen > 0)
30981                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
30982         else
30983                 _res_constr.data = NULL;
30984         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30985         for (size_t i = 0; i < _res_constr.datalen; i++) {
30986                 int64_t _res_conv_8 = _res_vals[i];
30987                 LDKFuture _res_conv_8_conv;
30988                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
30989                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
30990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
30991                 _res_constr.data[i] = _res_conv_8_conv;
30992         }
30993         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30994         CVec_FutureZ_free(_res_constr);
30995 }
30996
30997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30998         void* o_ptr = untag_ptr(o);
30999         CHECK_ACCESS(o_ptr);
31000         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
31001         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
31002         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31003         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
31004         return tag_ptr(ret_conv, true);
31005 }
31006
31007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31008         void* e_ptr = untag_ptr(e);
31009         CHECK_ACCESS(e_ptr);
31010         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31011         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31012         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31013         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
31014         return tag_ptr(ret_conv, true);
31015 }
31016
31017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31018         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
31019         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
31020         return ret_conv;
31021 }
31022
31023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31024         if (!ptr_is_owned(_res)) return;
31025         void* _res_ptr = untag_ptr(_res);
31026         CHECK_ACCESS(_res_ptr);
31027         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
31028         FREE(untag_ptr(_res));
31029         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
31030 }
31031
31032 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
31033         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31034         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
31035         return tag_ptr(ret_conv, true);
31036 }
31037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31038         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
31039         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
31040         return ret_conv;
31041 }
31042
31043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31044         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
31045         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31046         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
31047         return tag_ptr(ret_conv, true);
31048 }
31049
31050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
31051         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
31052         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31053         *ret_copy = COption_HTLCClaimZ_some(o_conv);
31054         int64_t ret_ref = tag_ptr(ret_copy, true);
31055         return ret_ref;
31056 }
31057
31058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
31059         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31060         *ret_copy = COption_HTLCClaimZ_none();
31061         int64_t ret_ref = tag_ptr(ret_copy, true);
31062         return ret_ref;
31063 }
31064
31065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31066         if (!ptr_is_owned(_res)) return;
31067         void* _res_ptr = untag_ptr(_res);
31068         CHECK_ACCESS(_res_ptr);
31069         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
31070         FREE(untag_ptr(_res));
31071         COption_HTLCClaimZ_free(_res_conv);
31072 }
31073
31074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31075         LDKCounterpartyCommitmentSecrets o_conv;
31076         o_conv.inner = untag_ptr(o);
31077         o_conv.is_owned = ptr_is_owned(o);
31078         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31079         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
31080         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31081         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
31082         return tag_ptr(ret_conv, true);
31083 }
31084
31085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31086         void* e_ptr = untag_ptr(e);
31087         CHECK_ACCESS(e_ptr);
31088         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31089         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31090         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31091         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
31092         return tag_ptr(ret_conv, true);
31093 }
31094
31095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31096         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
31097         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
31098         return ret_conv;
31099 }
31100
31101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31102         if (!ptr_is_owned(_res)) return;
31103         void* _res_ptr = untag_ptr(_res);
31104         CHECK_ACCESS(_res_ptr);
31105         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
31106         FREE(untag_ptr(_res));
31107         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
31108 }
31109
31110 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
31111         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31112         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
31113         return tag_ptr(ret_conv, true);
31114 }
31115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31116         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
31117         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
31118         return ret_conv;
31119 }
31120
31121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31122         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
31123         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31124         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
31125         return tag_ptr(ret_conv, true);
31126 }
31127
31128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31129         LDKTxCreationKeys o_conv;
31130         o_conv.inner = untag_ptr(o);
31131         o_conv.is_owned = ptr_is_owned(o);
31132         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31133         o_conv = TxCreationKeys_clone(&o_conv);
31134         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31135         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31136         return tag_ptr(ret_conv, true);
31137 }
31138
31139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31140         void* e_ptr = untag_ptr(e);
31141         CHECK_ACCESS(e_ptr);
31142         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31143         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31144         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31145         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31146         return tag_ptr(ret_conv, true);
31147 }
31148
31149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31150         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31151         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31152         return ret_conv;
31153 }
31154
31155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31156         if (!ptr_is_owned(_res)) return;
31157         void* _res_ptr = untag_ptr(_res);
31158         CHECK_ACCESS(_res_ptr);
31159         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31160         FREE(untag_ptr(_res));
31161         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31162 }
31163
31164 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31165         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31166         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31167         return tag_ptr(ret_conv, true);
31168 }
31169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31170         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31171         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31172         return ret_conv;
31173 }
31174
31175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31176         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31177         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31178         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31179         return tag_ptr(ret_conv, true);
31180 }
31181
31182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31183         LDKChannelPublicKeys o_conv;
31184         o_conv.inner = untag_ptr(o);
31185         o_conv.is_owned = ptr_is_owned(o);
31186         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31187         o_conv = ChannelPublicKeys_clone(&o_conv);
31188         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31189         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31190         return tag_ptr(ret_conv, true);
31191 }
31192
31193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31194         void* e_ptr = untag_ptr(e);
31195         CHECK_ACCESS(e_ptr);
31196         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31197         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31198         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31199         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31200         return tag_ptr(ret_conv, true);
31201 }
31202
31203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31204         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31205         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31206         return ret_conv;
31207 }
31208
31209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31210         if (!ptr_is_owned(_res)) return;
31211         void* _res_ptr = untag_ptr(_res);
31212         CHECK_ACCESS(_res_ptr);
31213         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31214         FREE(untag_ptr(_res));
31215         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31216 }
31217
31218 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31219         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31220         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31221         return tag_ptr(ret_conv, true);
31222 }
31223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31224         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31225         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31226         return ret_conv;
31227 }
31228
31229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31230         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31231         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31232         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31233         return tag_ptr(ret_conv, true);
31234 }
31235
31236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31237         LDKHTLCOutputInCommitment o_conv;
31238         o_conv.inner = untag_ptr(o);
31239         o_conv.is_owned = ptr_is_owned(o);
31240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31241         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31242         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31243         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31244         return tag_ptr(ret_conv, true);
31245 }
31246
31247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31248         void* e_ptr = untag_ptr(e);
31249         CHECK_ACCESS(e_ptr);
31250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31252         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31253         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31254         return tag_ptr(ret_conv, true);
31255 }
31256
31257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31258         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31259         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31260         return ret_conv;
31261 }
31262
31263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31264         if (!ptr_is_owned(_res)) return;
31265         void* _res_ptr = untag_ptr(_res);
31266         CHECK_ACCESS(_res_ptr);
31267         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31268         FREE(untag_ptr(_res));
31269         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31270 }
31271
31272 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31273         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31274         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31275         return tag_ptr(ret_conv, true);
31276 }
31277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31278         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31279         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31280         return ret_conv;
31281 }
31282
31283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31284         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31285         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31286         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31287         return tag_ptr(ret_conv, true);
31288 }
31289
31290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31291         LDKCounterpartyChannelTransactionParameters o_conv;
31292         o_conv.inner = untag_ptr(o);
31293         o_conv.is_owned = ptr_is_owned(o);
31294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31295         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31296         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31297         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31298         return tag_ptr(ret_conv, true);
31299 }
31300
31301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31302         void* e_ptr = untag_ptr(e);
31303         CHECK_ACCESS(e_ptr);
31304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31306         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31307         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31308         return tag_ptr(ret_conv, true);
31309 }
31310
31311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31312         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31313         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31314         return ret_conv;
31315 }
31316
31317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31318         if (!ptr_is_owned(_res)) return;
31319         void* _res_ptr = untag_ptr(_res);
31320         CHECK_ACCESS(_res_ptr);
31321         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31322         FREE(untag_ptr(_res));
31323         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31324 }
31325
31326 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31327         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31328         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31329         return tag_ptr(ret_conv, true);
31330 }
31331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31332         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31333         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31334         return ret_conv;
31335 }
31336
31337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31338         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31339         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31340         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31341         return tag_ptr(ret_conv, true);
31342 }
31343
31344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31345         LDKChannelTransactionParameters o_conv;
31346         o_conv.inner = untag_ptr(o);
31347         o_conv.is_owned = ptr_is_owned(o);
31348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31349         o_conv = ChannelTransactionParameters_clone(&o_conv);
31350         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31351         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31352         return tag_ptr(ret_conv, true);
31353 }
31354
31355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31356         void* e_ptr = untag_ptr(e);
31357         CHECK_ACCESS(e_ptr);
31358         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31359         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31360         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31361         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31362         return tag_ptr(ret_conv, true);
31363 }
31364
31365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31366         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31367         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31368         return ret_conv;
31369 }
31370
31371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31372         if (!ptr_is_owned(_res)) return;
31373         void* _res_ptr = untag_ptr(_res);
31374         CHECK_ACCESS(_res_ptr);
31375         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31376         FREE(untag_ptr(_res));
31377         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31378 }
31379
31380 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31381         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31382         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31383         return tag_ptr(ret_conv, true);
31384 }
31385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31386         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31387         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31388         return ret_conv;
31389 }
31390
31391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31392         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31393         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31394         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31395         return tag_ptr(ret_conv, true);
31396 }
31397
31398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31399         LDKHolderCommitmentTransaction o_conv;
31400         o_conv.inner = untag_ptr(o);
31401         o_conv.is_owned = ptr_is_owned(o);
31402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31403         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31404         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31405         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31406         return tag_ptr(ret_conv, true);
31407 }
31408
31409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31410         void* e_ptr = untag_ptr(e);
31411         CHECK_ACCESS(e_ptr);
31412         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31413         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31414         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31415         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31416         return tag_ptr(ret_conv, true);
31417 }
31418
31419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31420         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31421         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31422         return ret_conv;
31423 }
31424
31425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31426         if (!ptr_is_owned(_res)) return;
31427         void* _res_ptr = untag_ptr(_res);
31428         CHECK_ACCESS(_res_ptr);
31429         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31430         FREE(untag_ptr(_res));
31431         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31432 }
31433
31434 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31435         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31436         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31437         return tag_ptr(ret_conv, true);
31438 }
31439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31440         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31441         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31442         return ret_conv;
31443 }
31444
31445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31446         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31447         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31448         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31449         return tag_ptr(ret_conv, true);
31450 }
31451
31452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31453         LDKBuiltCommitmentTransaction o_conv;
31454         o_conv.inner = untag_ptr(o);
31455         o_conv.is_owned = ptr_is_owned(o);
31456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31457         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31458         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31459         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31460         return tag_ptr(ret_conv, true);
31461 }
31462
31463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31464         void* e_ptr = untag_ptr(e);
31465         CHECK_ACCESS(e_ptr);
31466         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31467         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31468         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31469         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31470         return tag_ptr(ret_conv, true);
31471 }
31472
31473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31474         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31475         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31476         return ret_conv;
31477 }
31478
31479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31480         if (!ptr_is_owned(_res)) return;
31481         void* _res_ptr = untag_ptr(_res);
31482         CHECK_ACCESS(_res_ptr);
31483         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31484         FREE(untag_ptr(_res));
31485         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31486 }
31487
31488 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31489         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31490         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31491         return tag_ptr(ret_conv, true);
31492 }
31493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31494         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31495         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31496         return ret_conv;
31497 }
31498
31499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31500         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31501         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31502         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31503         return tag_ptr(ret_conv, true);
31504 }
31505
31506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31507         LDKTrustedClosingTransaction o_conv;
31508         o_conv.inner = untag_ptr(o);
31509         o_conv.is_owned = ptr_is_owned(o);
31510         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31511         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31512         
31513         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31514         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31515         return tag_ptr(ret_conv, true);
31516 }
31517
31518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
31519         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31520         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31521         return tag_ptr(ret_conv, true);
31522 }
31523
31524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31525         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31526         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31527         return ret_conv;
31528 }
31529
31530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31531         if (!ptr_is_owned(_res)) return;
31532         void* _res_ptr = untag_ptr(_res);
31533         CHECK_ACCESS(_res_ptr);
31534         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31535         FREE(untag_ptr(_res));
31536         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31537 }
31538
31539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31540         LDKCommitmentTransaction o_conv;
31541         o_conv.inner = untag_ptr(o);
31542         o_conv.is_owned = ptr_is_owned(o);
31543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31544         o_conv = CommitmentTransaction_clone(&o_conv);
31545         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31546         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31547         return tag_ptr(ret_conv, true);
31548 }
31549
31550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31551         void* e_ptr = untag_ptr(e);
31552         CHECK_ACCESS(e_ptr);
31553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31555         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31556         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31557         return tag_ptr(ret_conv, true);
31558 }
31559
31560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31561         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31562         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31563         return ret_conv;
31564 }
31565
31566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31567         if (!ptr_is_owned(_res)) return;
31568         void* _res_ptr = untag_ptr(_res);
31569         CHECK_ACCESS(_res_ptr);
31570         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31571         FREE(untag_ptr(_res));
31572         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31573 }
31574
31575 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31576         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31577         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31578         return tag_ptr(ret_conv, true);
31579 }
31580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31581         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31582         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31583         return ret_conv;
31584 }
31585
31586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31587         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31588         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31589         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31590         return tag_ptr(ret_conv, true);
31591 }
31592
31593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31594         LDKTrustedCommitmentTransaction o_conv;
31595         o_conv.inner = untag_ptr(o);
31596         o_conv.is_owned = ptr_is_owned(o);
31597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31598         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31599         
31600         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31601         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31602         return tag_ptr(ret_conv, true);
31603 }
31604
31605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
31606         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31607         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
31608         return tag_ptr(ret_conv, true);
31609 }
31610
31611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31612         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
31613         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
31614         return ret_conv;
31615 }
31616
31617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31618         if (!ptr_is_owned(_res)) return;
31619         void* _res_ptr = untag_ptr(_res);
31620         CHECK_ACCESS(_res_ptr);
31621         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
31622         FREE(untag_ptr(_res));
31623         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
31624 }
31625
31626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
31627         LDKCVec_ECDSASignatureZ o_constr;
31628         o_constr.datalen = (*env)->GetArrayLength(env, o);
31629         if (o_constr.datalen > 0)
31630                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
31631         else
31632                 o_constr.data = NULL;
31633         for (size_t i = 0; i < o_constr.datalen; i++) {
31634                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
31635                 LDKECDSASignature o_conv_8_ref;
31636                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
31637                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
31638                 o_constr.data[i] = o_conv_8_ref;
31639         }
31640         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31641         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
31642         return tag_ptr(ret_conv, true);
31643 }
31644
31645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
31646         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31647         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
31648         return tag_ptr(ret_conv, true);
31649 }
31650
31651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31652         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
31653         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
31654         return ret_conv;
31655 }
31656
31657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31658         if (!ptr_is_owned(_res)) return;
31659         void* _res_ptr = untag_ptr(_res);
31660         CHECK_ACCESS(_res_ptr);
31661         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
31662         FREE(untag_ptr(_res));
31663         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
31664 }
31665
31666 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
31667         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31668         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
31669         return tag_ptr(ret_conv, true);
31670 }
31671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31672         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
31673         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
31674         return ret_conv;
31675 }
31676
31677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31678         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
31679         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31680         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
31681         return tag_ptr(ret_conv, true);
31682 }
31683
31684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31685         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31686         *ret_copy = COption_usizeZ_some(o);
31687         int64_t ret_ref = tag_ptr(ret_copy, true);
31688         return ret_ref;
31689 }
31690
31691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
31692         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31693         *ret_copy = COption_usizeZ_none();
31694         int64_t ret_ref = tag_ptr(ret_copy, true);
31695         return ret_ref;
31696 }
31697
31698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31699         if (!ptr_is_owned(_res)) return;
31700         void* _res_ptr = untag_ptr(_res);
31701         CHECK_ACCESS(_res_ptr);
31702         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
31703         FREE(untag_ptr(_res));
31704         COption_usizeZ_free(_res_conv);
31705 }
31706
31707 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
31708         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31709         *ret_copy = COption_usizeZ_clone(arg);
31710         int64_t ret_ref = tag_ptr(ret_copy, true);
31711         return ret_ref;
31712 }
31713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31714         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
31715         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
31716         return ret_conv;
31717 }
31718
31719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31720         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
31721         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31722         *ret_copy = COption_usizeZ_clone(orig_conv);
31723         int64_t ret_ref = tag_ptr(ret_copy, true);
31724         return ret_ref;
31725 }
31726
31727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31728         LDKShutdownScript o_conv;
31729         o_conv.inner = untag_ptr(o);
31730         o_conv.is_owned = ptr_is_owned(o);
31731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31732         o_conv = ShutdownScript_clone(&o_conv);
31733         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31734         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
31735         return tag_ptr(ret_conv, true);
31736 }
31737
31738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31739         void* e_ptr = untag_ptr(e);
31740         CHECK_ACCESS(e_ptr);
31741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31743         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31744         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
31745         return tag_ptr(ret_conv, true);
31746 }
31747
31748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31749         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
31750         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
31751         return ret_conv;
31752 }
31753
31754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31755         if (!ptr_is_owned(_res)) return;
31756         void* _res_ptr = untag_ptr(_res);
31757         CHECK_ACCESS(_res_ptr);
31758         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
31759         FREE(untag_ptr(_res));
31760         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
31761 }
31762
31763 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
31764         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31765         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
31766         return tag_ptr(ret_conv, true);
31767 }
31768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31769         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
31770         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
31771         return ret_conv;
31772 }
31773
31774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31775         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
31776         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31777         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
31778         return tag_ptr(ret_conv, true);
31779 }
31780
31781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31782         LDKShutdownScript o_conv;
31783         o_conv.inner = untag_ptr(o);
31784         o_conv.is_owned = ptr_is_owned(o);
31785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31786         o_conv = ShutdownScript_clone(&o_conv);
31787         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31788         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
31789         return tag_ptr(ret_conv, true);
31790 }
31791
31792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31793         LDKInvalidShutdownScript e_conv;
31794         e_conv.inner = untag_ptr(e);
31795         e_conv.is_owned = ptr_is_owned(e);
31796         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
31797         e_conv = InvalidShutdownScript_clone(&e_conv);
31798         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31799         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
31800         return tag_ptr(ret_conv, true);
31801 }
31802
31803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31804         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
31805         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
31806         return ret_conv;
31807 }
31808
31809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31810         if (!ptr_is_owned(_res)) return;
31811         void* _res_ptr = untag_ptr(_res);
31812         CHECK_ACCESS(_res_ptr);
31813         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
31814         FREE(untag_ptr(_res));
31815         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
31816 }
31817
31818 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
31819         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31820         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
31821         return tag_ptr(ret_conv, true);
31822 }
31823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31824         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
31825         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
31826         return ret_conv;
31827 }
31828
31829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31830         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
31831         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31832         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
31833         return tag_ptr(ret_conv, true);
31834 }
31835
31836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31837         void* o_ptr = untag_ptr(o);
31838         CHECK_ACCESS(o_ptr);
31839         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
31840         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
31841         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31842         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
31843         return tag_ptr(ret_conv, true);
31844 }
31845
31846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31847         void* e_ptr = untag_ptr(e);
31848         CHECK_ACCESS(e_ptr);
31849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31851         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31852         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
31853         return tag_ptr(ret_conv, true);
31854 }
31855
31856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31857         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
31858         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
31859         return ret_conv;
31860 }
31861
31862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31863         if (!ptr_is_owned(_res)) return;
31864         void* _res_ptr = untag_ptr(_res);
31865         CHECK_ACCESS(_res_ptr);
31866         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
31867         FREE(untag_ptr(_res));
31868         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
31869 }
31870
31871 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
31872         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31873         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
31874         return tag_ptr(ret_conv, true);
31875 }
31876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31877         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
31878         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
31879         return ret_conv;
31880 }
31881
31882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31883         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
31884         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31885         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
31886         return tag_ptr(ret_conv, true);
31887 }
31888
31889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31890         LDKClaimedHTLC o_conv;
31891         o_conv.inner = untag_ptr(o);
31892         o_conv.is_owned = ptr_is_owned(o);
31893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31894         o_conv = ClaimedHTLC_clone(&o_conv);
31895         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31896         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
31897         return tag_ptr(ret_conv, true);
31898 }
31899
31900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31901         void* e_ptr = untag_ptr(e);
31902         CHECK_ACCESS(e_ptr);
31903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31905         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31906         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
31907         return tag_ptr(ret_conv, true);
31908 }
31909
31910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31911         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
31912         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
31913         return ret_conv;
31914 }
31915
31916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31917         if (!ptr_is_owned(_res)) return;
31918         void* _res_ptr = untag_ptr(_res);
31919         CHECK_ACCESS(_res_ptr);
31920         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
31921         FREE(untag_ptr(_res));
31922         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
31923 }
31924
31925 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
31926         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31927         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
31928         return tag_ptr(ret_conv, true);
31929 }
31930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31931         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
31932         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
31933         return ret_conv;
31934 }
31935
31936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31937         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
31938         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31939         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
31940         return tag_ptr(ret_conv, true);
31941 }
31942
31943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31944         void* o_ptr = untag_ptr(o);
31945         CHECK_ACCESS(o_ptr);
31946         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
31947         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
31948         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31949         *ret_copy = COption_PathFailureZ_some(o_conv);
31950         int64_t ret_ref = tag_ptr(ret_copy, true);
31951         return ret_ref;
31952 }
31953
31954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
31955         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31956         *ret_copy = COption_PathFailureZ_none();
31957         int64_t ret_ref = tag_ptr(ret_copy, true);
31958         return ret_ref;
31959 }
31960
31961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31962         if (!ptr_is_owned(_res)) return;
31963         void* _res_ptr = untag_ptr(_res);
31964         CHECK_ACCESS(_res_ptr);
31965         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
31966         FREE(untag_ptr(_res));
31967         COption_PathFailureZ_free(_res_conv);
31968 }
31969
31970 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
31971         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31972         *ret_copy = COption_PathFailureZ_clone(arg);
31973         int64_t ret_ref = tag_ptr(ret_copy, true);
31974         return ret_ref;
31975 }
31976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31977         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
31978         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
31979         return ret_conv;
31980 }
31981
31982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31983         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
31984         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31985         *ret_copy = COption_PathFailureZ_clone(orig_conv);
31986         int64_t ret_ref = tag_ptr(ret_copy, true);
31987         return ret_ref;
31988 }
31989
31990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31991         void* o_ptr = untag_ptr(o);
31992         CHECK_ACCESS(o_ptr);
31993         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
31994         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
31995         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31996         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
31997         return tag_ptr(ret_conv, true);
31998 }
31999
32000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32001         void* e_ptr = untag_ptr(e);
32002         CHECK_ACCESS(e_ptr);
32003         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32004         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32005         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32006         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
32007         return tag_ptr(ret_conv, true);
32008 }
32009
32010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32011         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
32012         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
32013         return ret_conv;
32014 }
32015
32016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32017         if (!ptr_is_owned(_res)) return;
32018         void* _res_ptr = untag_ptr(_res);
32019         CHECK_ACCESS(_res_ptr);
32020         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
32021         FREE(untag_ptr(_res));
32022         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
32023 }
32024
32025 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
32026         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32027         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
32028         return tag_ptr(ret_conv, true);
32029 }
32030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32031         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
32032         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
32033         return ret_conv;
32034 }
32035
32036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32037         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
32038         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32039         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
32040         return tag_ptr(ret_conv, true);
32041 }
32042
32043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32044         void* o_ptr = untag_ptr(o);
32045         CHECK_ACCESS(o_ptr);
32046         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
32047         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
32048         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32049         *ret_copy = COption_ClosureReasonZ_some(o_conv);
32050         int64_t ret_ref = tag_ptr(ret_copy, true);
32051         return ret_ref;
32052 }
32053
32054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
32055         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32056         *ret_copy = COption_ClosureReasonZ_none();
32057         int64_t ret_ref = tag_ptr(ret_copy, true);
32058         return ret_ref;
32059 }
32060
32061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32062         if (!ptr_is_owned(_res)) return;
32063         void* _res_ptr = untag_ptr(_res);
32064         CHECK_ACCESS(_res_ptr);
32065         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
32066         FREE(untag_ptr(_res));
32067         COption_ClosureReasonZ_free(_res_conv);
32068 }
32069
32070 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
32071         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32072         *ret_copy = COption_ClosureReasonZ_clone(arg);
32073         int64_t ret_ref = tag_ptr(ret_copy, true);
32074         return ret_ref;
32075 }
32076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32077         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
32078         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
32079         return ret_conv;
32080 }
32081
32082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32083         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
32084         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32085         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
32086         int64_t ret_ref = tag_ptr(ret_copy, true);
32087         return ret_ref;
32088 }
32089
32090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32091         void* o_ptr = untag_ptr(o);
32092         CHECK_ACCESS(o_ptr);
32093         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
32094         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
32095         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32096         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
32097         return tag_ptr(ret_conv, true);
32098 }
32099
32100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32101         void* e_ptr = untag_ptr(e);
32102         CHECK_ACCESS(e_ptr);
32103         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32104         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32105         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32106         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32107         return tag_ptr(ret_conv, true);
32108 }
32109
32110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32111         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32112         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32113         return ret_conv;
32114 }
32115
32116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32117         if (!ptr_is_owned(_res)) return;
32118         void* _res_ptr = untag_ptr(_res);
32119         CHECK_ACCESS(_res_ptr);
32120         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32121         FREE(untag_ptr(_res));
32122         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32123 }
32124
32125 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32126         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32127         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32128         return tag_ptr(ret_conv, true);
32129 }
32130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32131         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32132         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32133         return ret_conv;
32134 }
32135
32136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32137         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32138         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32139         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32140         return tag_ptr(ret_conv, true);
32141 }
32142
32143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32144         void* o_ptr = untag_ptr(o);
32145         CHECK_ACCESS(o_ptr);
32146         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32147         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32148         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32149         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32150         int64_t ret_ref = tag_ptr(ret_copy, true);
32151         return ret_ref;
32152 }
32153
32154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
32155         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32156         *ret_copy = COption_HTLCDestinationZ_none();
32157         int64_t ret_ref = tag_ptr(ret_copy, true);
32158         return ret_ref;
32159 }
32160
32161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32162         if (!ptr_is_owned(_res)) return;
32163         void* _res_ptr = untag_ptr(_res);
32164         CHECK_ACCESS(_res_ptr);
32165         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32166         FREE(untag_ptr(_res));
32167         COption_HTLCDestinationZ_free(_res_conv);
32168 }
32169
32170 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32171         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32172         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32173         int64_t ret_ref = tag_ptr(ret_copy, true);
32174         return ret_ref;
32175 }
32176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32177         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32178         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32179         return ret_conv;
32180 }
32181
32182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32183         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32184         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32185         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32186         int64_t ret_ref = tag_ptr(ret_copy, true);
32187         return ret_ref;
32188 }
32189
32190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32191         void* o_ptr = untag_ptr(o);
32192         CHECK_ACCESS(o_ptr);
32193         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32194         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32195         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32196         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32197         return tag_ptr(ret_conv, true);
32198 }
32199
32200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32201         void* e_ptr = untag_ptr(e);
32202         CHECK_ACCESS(e_ptr);
32203         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32204         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32205         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32206         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32207         return tag_ptr(ret_conv, true);
32208 }
32209
32210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32211         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32212         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32213         return ret_conv;
32214 }
32215
32216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32217         if (!ptr_is_owned(_res)) return;
32218         void* _res_ptr = untag_ptr(_res);
32219         CHECK_ACCESS(_res_ptr);
32220         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32221         FREE(untag_ptr(_res));
32222         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32223 }
32224
32225 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32226         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32227         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32228         return tag_ptr(ret_conv, true);
32229 }
32230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32231         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32232         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32233         return ret_conv;
32234 }
32235
32236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32237         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32238         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32239         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32240         return tag_ptr(ret_conv, true);
32241 }
32242
32243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
32244         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32245         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32246         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32247         return tag_ptr(ret_conv, true);
32248 }
32249
32250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32251         void* e_ptr = untag_ptr(e);
32252         CHECK_ACCESS(e_ptr);
32253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32255         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32256         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32257         return tag_ptr(ret_conv, true);
32258 }
32259
32260 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32261         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32262         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32263         return ret_conv;
32264 }
32265
32266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32267         if (!ptr_is_owned(_res)) return;
32268         void* _res_ptr = untag_ptr(_res);
32269         CHECK_ACCESS(_res_ptr);
32270         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32271         FREE(untag_ptr(_res));
32272         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32273 }
32274
32275 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32276         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32277         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32278         return tag_ptr(ret_conv, true);
32279 }
32280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32281         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32282         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32283         return ret_conv;
32284 }
32285
32286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32287         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32288         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32289         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32290         return tag_ptr(ret_conv, true);
32291 }
32292
32293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
32294         LDKU128 o_ref;
32295         CHECK((*env)->GetArrayLength(env, o) == 16);
32296         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
32297         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32298         *ret_copy = COption_U128Z_some(o_ref);
32299         int64_t ret_ref = tag_ptr(ret_copy, true);
32300         return ret_ref;
32301 }
32302
32303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
32304         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32305         *ret_copy = COption_U128Z_none();
32306         int64_t ret_ref = tag_ptr(ret_copy, true);
32307         return ret_ref;
32308 }
32309
32310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
32311         if (!ptr_is_owned(_res)) return;
32312         void* _res_ptr = untag_ptr(_res);
32313         CHECK_ACCESS(_res_ptr);
32314         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32315         FREE(untag_ptr(_res));
32316         COption_U128Z_free(_res_conv);
32317 }
32318
32319 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32320         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32321         *ret_copy = COption_U128Z_clone(arg);
32322         int64_t ret_ref = tag_ptr(ret_copy, true);
32323         return ret_ref;
32324 }
32325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32326         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32327         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32328         return ret_conv;
32329 }
32330
32331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32332         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32333         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32334         *ret_copy = COption_U128Z_clone(orig_conv);
32335         int64_t ret_ref = tag_ptr(ret_copy, true);
32336         return ret_ref;
32337 }
32338
32339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32340         LDKCVec_ClaimedHTLCZ _res_constr;
32341         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32342         if (_res_constr.datalen > 0)
32343                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32344         else
32345                 _res_constr.data = NULL;
32346         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32347         for (size_t n = 0; n < _res_constr.datalen; n++) {
32348                 int64_t _res_conv_13 = _res_vals[n];
32349                 LDKClaimedHTLC _res_conv_13_conv;
32350                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32351                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32352                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32353                 _res_constr.data[n] = _res_conv_13_conv;
32354         }
32355         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32356         CVec_ClaimedHTLCZ_free(_res_constr);
32357 }
32358
32359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
32360         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32361         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32362         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32363         int64_t ret_ref = tag_ptr(ret_copy, true);
32364         return ret_ref;
32365 }
32366
32367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
32368         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32369         *ret_copy = COption_PaymentFailureReasonZ_none();
32370         int64_t ret_ref = tag_ptr(ret_copy, true);
32371         return ret_ref;
32372 }
32373
32374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32375         if (!ptr_is_owned(_res)) return;
32376         void* _res_ptr = untag_ptr(_res);
32377         CHECK_ACCESS(_res_ptr);
32378         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32379         FREE(untag_ptr(_res));
32380         COption_PaymentFailureReasonZ_free(_res_conv);
32381 }
32382
32383 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32384         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32385         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32386         int64_t ret_ref = tag_ptr(ret_copy, true);
32387         return ret_ref;
32388 }
32389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32390         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32391         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32392         return ret_conv;
32393 }
32394
32395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32396         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32397         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32398         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32399         int64_t ret_ref = tag_ptr(ret_copy, true);
32400         return ret_ref;
32401 }
32402
32403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32404         void* o_ptr = untag_ptr(o);
32405         CHECK_ACCESS(o_ptr);
32406         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32407         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32408         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32409         *ret_copy = COption_EventZ_some(o_conv);
32410         int64_t ret_ref = tag_ptr(ret_copy, true);
32411         return ret_ref;
32412 }
32413
32414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
32415         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32416         *ret_copy = COption_EventZ_none();
32417         int64_t ret_ref = tag_ptr(ret_copy, true);
32418         return ret_ref;
32419 }
32420
32421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32422         if (!ptr_is_owned(_res)) return;
32423         void* _res_ptr = untag_ptr(_res);
32424         CHECK_ACCESS(_res_ptr);
32425         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32426         FREE(untag_ptr(_res));
32427         COption_EventZ_free(_res_conv);
32428 }
32429
32430 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32431         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32432         *ret_copy = COption_EventZ_clone(arg);
32433         int64_t ret_ref = tag_ptr(ret_copy, true);
32434         return ret_ref;
32435 }
32436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32437         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32438         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32439         return ret_conv;
32440 }
32441
32442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32443         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32444         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32445         *ret_copy = COption_EventZ_clone(orig_conv);
32446         int64_t ret_ref = tag_ptr(ret_copy, true);
32447         return ret_ref;
32448 }
32449
32450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32451         void* o_ptr = untag_ptr(o);
32452         CHECK_ACCESS(o_ptr);
32453         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32454         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32455         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32456         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32457         return tag_ptr(ret_conv, true);
32458 }
32459
32460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32461         void* e_ptr = untag_ptr(e);
32462         CHECK_ACCESS(e_ptr);
32463         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32464         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32465         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32466         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32467         return tag_ptr(ret_conv, true);
32468 }
32469
32470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32471         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32472         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32473         return ret_conv;
32474 }
32475
32476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32477         if (!ptr_is_owned(_res)) return;
32478         void* _res_ptr = untag_ptr(_res);
32479         CHECK_ACCESS(_res_ptr);
32480         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32481         FREE(untag_ptr(_res));
32482         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32483 }
32484
32485 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32486         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32487         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32488         return tag_ptr(ret_conv, true);
32489 }
32490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32491         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32492         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32493         return ret_conv;
32494 }
32495
32496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32497         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32498         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32499         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32500         return tag_ptr(ret_conv, true);
32501 }
32502
32503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
32504         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
32505         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32506         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32507         return tag_ptr(ret_conv, true);
32508 }
32509
32510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32511         void* e_ptr = untag_ptr(e);
32512         CHECK_ACCESS(e_ptr);
32513         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32514         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32515         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32516         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32517         return tag_ptr(ret_conv, true);
32518 }
32519
32520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32521         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32522         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32523         return ret_conv;
32524 }
32525
32526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32527         if (!ptr_is_owned(_res)) return;
32528         void* _res_ptr = untag_ptr(_res);
32529         CHECK_ACCESS(_res_ptr);
32530         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32531         FREE(untag_ptr(_res));
32532         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32533 }
32534
32535 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32536         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32537         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32538         return tag_ptr(ret_conv, true);
32539 }
32540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32541         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32542         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32543         return ret_conv;
32544 }
32545
32546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32547         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32548         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32549         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32550         return tag_ptr(ret_conv, true);
32551 }
32552
32553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32554         LDKBolt11Invoice o_conv;
32555         o_conv.inner = untag_ptr(o);
32556         o_conv.is_owned = ptr_is_owned(o);
32557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32558         o_conv = Bolt11Invoice_clone(&o_conv);
32559         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32560         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32561         return tag_ptr(ret_conv, true);
32562 }
32563
32564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32565         void* e_ptr = untag_ptr(e);
32566         CHECK_ACCESS(e_ptr);
32567         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32568         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32569         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32570         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32571         return tag_ptr(ret_conv, true);
32572 }
32573
32574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32575         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32576         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32577         return ret_conv;
32578 }
32579
32580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32581         if (!ptr_is_owned(_res)) return;
32582         void* _res_ptr = untag_ptr(_res);
32583         CHECK_ACCESS(_res_ptr);
32584         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
32585         FREE(untag_ptr(_res));
32586         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
32587 }
32588
32589 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
32590         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32591         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
32592         return tag_ptr(ret_conv, true);
32593 }
32594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32595         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
32596         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
32597         return ret_conv;
32598 }
32599
32600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32601         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
32602         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32603         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
32604         return tag_ptr(ret_conv, true);
32605 }
32606
32607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32608         LDKSignedRawBolt11Invoice o_conv;
32609         o_conv.inner = untag_ptr(o);
32610         o_conv.is_owned = ptr_is_owned(o);
32611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32612         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
32613         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32614         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
32615         return tag_ptr(ret_conv, true);
32616 }
32617
32618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32619         void* e_ptr = untag_ptr(e);
32620         CHECK_ACCESS(e_ptr);
32621         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32622         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32623         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32624         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
32625         return tag_ptr(ret_conv, true);
32626 }
32627
32628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32629         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
32630         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
32631         return ret_conv;
32632 }
32633
32634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32635         if (!ptr_is_owned(_res)) return;
32636         void* _res_ptr = untag_ptr(_res);
32637         CHECK_ACCESS(_res_ptr);
32638         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
32639         FREE(untag_ptr(_res));
32640         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
32641 }
32642
32643 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
32644         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32645         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
32646         return tag_ptr(ret_conv, true);
32647 }
32648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32649         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
32650         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
32651         return ret_conv;
32652 }
32653
32654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32655         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
32656         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32657         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
32658         return tag_ptr(ret_conv, true);
32659 }
32660
32661 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
32662         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32663         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
32664         return tag_ptr(ret_conv, true);
32665 }
32666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32667         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
32668         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
32669         return ret_conv;
32670 }
32671
32672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32673         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
32674         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32675         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
32676         return tag_ptr(ret_conv, true);
32677 }
32678
32679 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) {
32680         LDKRawBolt11Invoice a_conv;
32681         a_conv.inner = untag_ptr(a);
32682         a_conv.is_owned = ptr_is_owned(a);
32683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32684         a_conv = RawBolt11Invoice_clone(&a_conv);
32685         LDKThirtyTwoBytes b_ref;
32686         CHECK((*env)->GetArrayLength(env, b) == 32);
32687         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
32688         LDKBolt11InvoiceSignature c_conv;
32689         c_conv.inner = untag_ptr(c);
32690         c_conv.is_owned = ptr_is_owned(c);
32691         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32692         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
32693         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32694         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
32695         return tag_ptr(ret_conv, true);
32696 }
32697
32698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32699         if (!ptr_is_owned(_res)) return;
32700         void* _res_ptr = untag_ptr(_res);
32701         CHECK_ACCESS(_res_ptr);
32702         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
32703         FREE(untag_ptr(_res));
32704         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
32705 }
32706
32707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32708         LDKPayeePubKey o_conv;
32709         o_conv.inner = untag_ptr(o);
32710         o_conv.is_owned = ptr_is_owned(o);
32711         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32712         o_conv = PayeePubKey_clone(&o_conv);
32713         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32714         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
32715         return tag_ptr(ret_conv, true);
32716 }
32717
32718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32719         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
32720         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32721         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
32722         return tag_ptr(ret_conv, true);
32723 }
32724
32725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32726         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
32727         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
32728         return ret_conv;
32729 }
32730
32731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32732         if (!ptr_is_owned(_res)) return;
32733         void* _res_ptr = untag_ptr(_res);
32734         CHECK_ACCESS(_res_ptr);
32735         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
32736         FREE(untag_ptr(_res));
32737         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
32738 }
32739
32740 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
32741         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32742         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
32743         return tag_ptr(ret_conv, true);
32744 }
32745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32746         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
32747         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
32748         return ret_conv;
32749 }
32750
32751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32752         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
32753         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32754         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
32755         return tag_ptr(ret_conv, true);
32756 }
32757
32758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32759         LDKCVec_PrivateRouteZ _res_constr;
32760         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32761         if (_res_constr.datalen > 0)
32762                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
32763         else
32764                 _res_constr.data = NULL;
32765         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32766         for (size_t o = 0; o < _res_constr.datalen; o++) {
32767                 int64_t _res_conv_14 = _res_vals[o];
32768                 LDKPrivateRoute _res_conv_14_conv;
32769                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
32770                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
32771                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
32772                 _res_constr.data[o] = _res_conv_14_conv;
32773         }
32774         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32775         CVec_PrivateRouteZ_free(_res_constr);
32776 }
32777
32778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32779         LDKPositiveTimestamp o_conv;
32780         o_conv.inner = untag_ptr(o);
32781         o_conv.is_owned = ptr_is_owned(o);
32782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32783         o_conv = PositiveTimestamp_clone(&o_conv);
32784         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32785         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
32786         return tag_ptr(ret_conv, true);
32787 }
32788
32789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32790         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
32791         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32792         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
32793         return tag_ptr(ret_conv, true);
32794 }
32795
32796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32797         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
32798         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
32799         return ret_conv;
32800 }
32801
32802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32803         if (!ptr_is_owned(_res)) return;
32804         void* _res_ptr = untag_ptr(_res);
32805         CHECK_ACCESS(_res_ptr);
32806         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
32807         FREE(untag_ptr(_res));
32808         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
32809 }
32810
32811 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
32812         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32813         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
32814         return tag_ptr(ret_conv, true);
32815 }
32816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32817         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
32818         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
32819         return ret_conv;
32820 }
32821
32822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32823         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
32824         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32825         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
32826         return tag_ptr(ret_conv, true);
32827 }
32828
32829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
32830         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32831         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
32832         return tag_ptr(ret_conv, true);
32833 }
32834
32835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32836         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
32837         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32838         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
32839         return tag_ptr(ret_conv, true);
32840 }
32841
32842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32843         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
32844         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
32845         return ret_conv;
32846 }
32847
32848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32849         if (!ptr_is_owned(_res)) return;
32850         void* _res_ptr = untag_ptr(_res);
32851         CHECK_ACCESS(_res_ptr);
32852         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
32853         FREE(untag_ptr(_res));
32854         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
32855 }
32856
32857 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
32858         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32859         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
32860         return tag_ptr(ret_conv, true);
32861 }
32862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32863         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
32864         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
32865         return ret_conv;
32866 }
32867
32868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32869         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
32870         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32871         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
32872         return tag_ptr(ret_conv, true);
32873 }
32874
32875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32876         LDKBolt11Invoice o_conv;
32877         o_conv.inner = untag_ptr(o);
32878         o_conv.is_owned = ptr_is_owned(o);
32879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32880         o_conv = Bolt11Invoice_clone(&o_conv);
32881         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32882         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
32883         return tag_ptr(ret_conv, true);
32884 }
32885
32886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32887         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
32888         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32889         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
32890         return tag_ptr(ret_conv, true);
32891 }
32892
32893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32894         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
32895         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
32896         return ret_conv;
32897 }
32898
32899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32900         if (!ptr_is_owned(_res)) return;
32901         void* _res_ptr = untag_ptr(_res);
32902         CHECK_ACCESS(_res_ptr);
32903         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
32904         FREE(untag_ptr(_res));
32905         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
32906 }
32907
32908 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
32909         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32910         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
32911         return tag_ptr(ret_conv, true);
32912 }
32913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32914         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
32915         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
32916         return ret_conv;
32917 }
32918
32919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32920         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
32921         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32922         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
32923         return tag_ptr(ret_conv, true);
32924 }
32925
32926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32927         LDKDescription o_conv;
32928         o_conv.inner = untag_ptr(o);
32929         o_conv.is_owned = ptr_is_owned(o);
32930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32931         o_conv = Description_clone(&o_conv);
32932         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32933         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
32934         return tag_ptr(ret_conv, true);
32935 }
32936
32937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32938         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
32939         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32940         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
32941         return tag_ptr(ret_conv, true);
32942 }
32943
32944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32945         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
32946         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
32947         return ret_conv;
32948 }
32949
32950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32951         if (!ptr_is_owned(_res)) return;
32952         void* _res_ptr = untag_ptr(_res);
32953         CHECK_ACCESS(_res_ptr);
32954         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
32955         FREE(untag_ptr(_res));
32956         CResult_DescriptionCreationErrorZ_free(_res_conv);
32957 }
32958
32959 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
32960         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32961         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
32962         return tag_ptr(ret_conv, true);
32963 }
32964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32965         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
32966         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
32967         return ret_conv;
32968 }
32969
32970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32971         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
32972         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32973         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
32974         return tag_ptr(ret_conv, true);
32975 }
32976
32977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32978         LDKPrivateRoute o_conv;
32979         o_conv.inner = untag_ptr(o);
32980         o_conv.is_owned = ptr_is_owned(o);
32981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32982         o_conv = PrivateRoute_clone(&o_conv);
32983         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32984         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
32985         return tag_ptr(ret_conv, true);
32986 }
32987
32988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32989         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
32990         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32991         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
32992         return tag_ptr(ret_conv, true);
32993 }
32994
32995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32996         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
32997         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
32998         return ret_conv;
32999 }
33000
33001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33002         if (!ptr_is_owned(_res)) return;
33003         void* _res_ptr = untag_ptr(_res);
33004         CHECK_ACCESS(_res_ptr);
33005         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
33006         FREE(untag_ptr(_res));
33007         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
33008 }
33009
33010 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
33011         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33012         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
33013         return tag_ptr(ret_conv, true);
33014 }
33015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33016         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
33017         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
33018         return ret_conv;
33019 }
33020
33021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33022         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
33023         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33024         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
33025         return tag_ptr(ret_conv, true);
33026 }
33027
33028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33029         LDKOutPoint o_conv;
33030         o_conv.inner = untag_ptr(o);
33031         o_conv.is_owned = ptr_is_owned(o);
33032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33033         o_conv = OutPoint_clone(&o_conv);
33034         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33035         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
33036         return tag_ptr(ret_conv, true);
33037 }
33038
33039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33040         void* e_ptr = untag_ptr(e);
33041         CHECK_ACCESS(e_ptr);
33042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33044         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33045         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
33046         return tag_ptr(ret_conv, true);
33047 }
33048
33049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33050         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
33051         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
33052         return ret_conv;
33053 }
33054
33055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33056         if (!ptr_is_owned(_res)) return;
33057         void* _res_ptr = untag_ptr(_res);
33058         CHECK_ACCESS(_res_ptr);
33059         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
33060         FREE(untag_ptr(_res));
33061         CResult_OutPointDecodeErrorZ_free(_res_conv);
33062 }
33063
33064 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
33065         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33066         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
33067         return tag_ptr(ret_conv, true);
33068 }
33069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33070         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
33071         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
33072         return ret_conv;
33073 }
33074
33075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33076         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
33077         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33078         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
33079         return tag_ptr(ret_conv, true);
33080 }
33081
33082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33083         LDKBigSize o_conv;
33084         o_conv.inner = untag_ptr(o);
33085         o_conv.is_owned = ptr_is_owned(o);
33086         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33087         o_conv = BigSize_clone(&o_conv);
33088         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33089         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
33090         return tag_ptr(ret_conv, true);
33091 }
33092
33093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33094         void* e_ptr = untag_ptr(e);
33095         CHECK_ACCESS(e_ptr);
33096         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33097         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33098         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33099         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
33100         return tag_ptr(ret_conv, true);
33101 }
33102
33103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33104         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33105         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33106         return ret_conv;
33107 }
33108
33109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33110         if (!ptr_is_owned(_res)) return;
33111         void* _res_ptr = untag_ptr(_res);
33112         CHECK_ACCESS(_res_ptr);
33113         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33114         FREE(untag_ptr(_res));
33115         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33116 }
33117
33118 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33119         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33120         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33121         return tag_ptr(ret_conv, true);
33122 }
33123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33124         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33125         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33126         return ret_conv;
33127 }
33128
33129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33130         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33131         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33132         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33133         return tag_ptr(ret_conv, true);
33134 }
33135
33136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33137         LDKHostname o_conv;
33138         o_conv.inner = untag_ptr(o);
33139         o_conv.is_owned = ptr_is_owned(o);
33140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33141         o_conv = Hostname_clone(&o_conv);
33142         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33143         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33144         return tag_ptr(ret_conv, true);
33145 }
33146
33147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33148         void* e_ptr = untag_ptr(e);
33149         CHECK_ACCESS(e_ptr);
33150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33152         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33153         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33154         return tag_ptr(ret_conv, true);
33155 }
33156
33157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33158         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33159         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33160         return ret_conv;
33161 }
33162
33163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33164         if (!ptr_is_owned(_res)) return;
33165         void* _res_ptr = untag_ptr(_res);
33166         CHECK_ACCESS(_res_ptr);
33167         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33168         FREE(untag_ptr(_res));
33169         CResult_HostnameDecodeErrorZ_free(_res_conv);
33170 }
33171
33172 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33173         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33174         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33175         return tag_ptr(ret_conv, true);
33176 }
33177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33178         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33179         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33180         return ret_conv;
33181 }
33182
33183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33184         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33185         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33186         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33187         return tag_ptr(ret_conv, true);
33188 }
33189
33190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33191         LDKTransactionU16LenLimited o_conv;
33192         o_conv.inner = untag_ptr(o);
33193         o_conv.is_owned = ptr_is_owned(o);
33194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33195         o_conv = TransactionU16LenLimited_clone(&o_conv);
33196         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33197         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33198         return tag_ptr(ret_conv, true);
33199 }
33200
33201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
33202         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33203         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33204         return tag_ptr(ret_conv, true);
33205 }
33206
33207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33208         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33209         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33210         return ret_conv;
33211 }
33212
33213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33214         if (!ptr_is_owned(_res)) return;
33215         void* _res_ptr = untag_ptr(_res);
33216         CHECK_ACCESS(_res_ptr);
33217         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33218         FREE(untag_ptr(_res));
33219         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33220 }
33221
33222 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33223         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33224         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33225         return tag_ptr(ret_conv, true);
33226 }
33227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33228         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33229         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33230         return ret_conv;
33231 }
33232
33233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33234         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33235         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33236         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33237         return tag_ptr(ret_conv, true);
33238 }
33239
33240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33241         LDKTransactionU16LenLimited o_conv;
33242         o_conv.inner = untag_ptr(o);
33243         o_conv.is_owned = ptr_is_owned(o);
33244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33245         o_conv = TransactionU16LenLimited_clone(&o_conv);
33246         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33247         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33248         return tag_ptr(ret_conv, true);
33249 }
33250
33251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33252         void* e_ptr = untag_ptr(e);
33253         CHECK_ACCESS(e_ptr);
33254         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33255         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33256         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33257         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33258         return tag_ptr(ret_conv, true);
33259 }
33260
33261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33262         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33263         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33264         return ret_conv;
33265 }
33266
33267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33268         if (!ptr_is_owned(_res)) return;
33269         void* _res_ptr = untag_ptr(_res);
33270         CHECK_ACCESS(_res_ptr);
33271         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33272         FREE(untag_ptr(_res));
33273         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33274 }
33275
33276 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33277         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33278         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33279         return tag_ptr(ret_conv, true);
33280 }
33281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33282         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33283         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33284         return ret_conv;
33285 }
33286
33287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33288         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33289         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33290         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33291         return tag_ptr(ret_conv, true);
33292 }
33293
33294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33295         LDKUntrustedString o_conv;
33296         o_conv.inner = untag_ptr(o);
33297         o_conv.is_owned = ptr_is_owned(o);
33298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33299         o_conv = UntrustedString_clone(&o_conv);
33300         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33301         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33302         return tag_ptr(ret_conv, true);
33303 }
33304
33305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33306         void* e_ptr = untag_ptr(e);
33307         CHECK_ACCESS(e_ptr);
33308         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33309         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33310         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33311         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33312         return tag_ptr(ret_conv, true);
33313 }
33314
33315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33316         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33317         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33318         return ret_conv;
33319 }
33320
33321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33322         if (!ptr_is_owned(_res)) return;
33323         void* _res_ptr = untag_ptr(_res);
33324         CHECK_ACCESS(_res_ptr);
33325         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33326         FREE(untag_ptr(_res));
33327         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33328 }
33329
33330 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33331         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33332         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33333         return tag_ptr(ret_conv, true);
33334 }
33335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33336         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33337         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33338         return ret_conv;
33339 }
33340
33341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33342         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33343         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33344         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33345         return tag_ptr(ret_conv, true);
33346 }
33347
33348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33349         LDKReceiveTlvs o_conv;
33350         o_conv.inner = untag_ptr(o);
33351         o_conv.is_owned = ptr_is_owned(o);
33352         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33353         o_conv = ReceiveTlvs_clone(&o_conv);
33354         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33355         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
33356         return tag_ptr(ret_conv, true);
33357 }
33358
33359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33360         void* e_ptr = untag_ptr(e);
33361         CHECK_ACCESS(e_ptr);
33362         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33363         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33364         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33365         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
33366         return tag_ptr(ret_conv, true);
33367 }
33368
33369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33370         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
33371         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
33372         return ret_conv;
33373 }
33374
33375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33376         if (!ptr_is_owned(_res)) return;
33377         void* _res_ptr = untag_ptr(_res);
33378         CHECK_ACCESS(_res_ptr);
33379         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
33380         FREE(untag_ptr(_res));
33381         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
33382 }
33383
33384 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
33385         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33386         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
33387         return tag_ptr(ret_conv, true);
33388 }
33389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33390         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
33391         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
33392         return ret_conv;
33393 }
33394
33395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33396         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
33397         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33398         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
33399         return tag_ptr(ret_conv, true);
33400 }
33401
33402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33403         LDKPaymentRelay o_conv;
33404         o_conv.inner = untag_ptr(o);
33405         o_conv.is_owned = ptr_is_owned(o);
33406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33407         o_conv = PaymentRelay_clone(&o_conv);
33408         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33409         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33410         return tag_ptr(ret_conv, true);
33411 }
33412
33413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33414         void* e_ptr = untag_ptr(e);
33415         CHECK_ACCESS(e_ptr);
33416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33418         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33419         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33420         return tag_ptr(ret_conv, true);
33421 }
33422
33423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33424         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33425         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33426         return ret_conv;
33427 }
33428
33429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33430         if (!ptr_is_owned(_res)) return;
33431         void* _res_ptr = untag_ptr(_res);
33432         CHECK_ACCESS(_res_ptr);
33433         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33434         FREE(untag_ptr(_res));
33435         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33436 }
33437
33438 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33439         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33440         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33441         return tag_ptr(ret_conv, true);
33442 }
33443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33444         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33445         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33446         return ret_conv;
33447 }
33448
33449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33450         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33451         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33452         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33453         return tag_ptr(ret_conv, true);
33454 }
33455
33456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33457         LDKPaymentConstraints o_conv;
33458         o_conv.inner = untag_ptr(o);
33459         o_conv.is_owned = ptr_is_owned(o);
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33461         o_conv = PaymentConstraints_clone(&o_conv);
33462         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33463         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33464         return tag_ptr(ret_conv, true);
33465 }
33466
33467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33468         void* e_ptr = untag_ptr(e);
33469         CHECK_ACCESS(e_ptr);
33470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33472         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33473         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33474         return tag_ptr(ret_conv, true);
33475 }
33476
33477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33478         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33479         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33480         return ret_conv;
33481 }
33482
33483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33484         if (!ptr_is_owned(_res)) return;
33485         void* _res_ptr = untag_ptr(_res);
33486         CHECK_ACCESS(_res_ptr);
33487         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33488         FREE(untag_ptr(_res));
33489         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33490 }
33491
33492 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33493         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33494         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33495         return tag_ptr(ret_conv, true);
33496 }
33497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33498         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33499         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33500         return ret_conv;
33501 }
33502
33503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33504         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33505         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33506         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33507         return tag_ptr(ret_conv, true);
33508 }
33509
33510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
33511         LDKThirtyTwoBytes o_ref;
33512         CHECK((*env)->GetArrayLength(env, o) == 32);
33513         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
33514         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33515         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
33516         return tag_ptr(ret_conv, true);
33517 }
33518
33519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33520         void* e_ptr = untag_ptr(e);
33521         CHECK_ACCESS(e_ptr);
33522         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
33523         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
33524         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33525         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
33526         return tag_ptr(ret_conv, true);
33527 }
33528
33529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33530         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
33531         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
33532         return ret_conv;
33533 }
33534
33535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33536         if (!ptr_is_owned(_res)) return;
33537         void* _res_ptr = untag_ptr(_res);
33538         CHECK_ACCESS(_res_ptr);
33539         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
33540         FREE(untag_ptr(_res));
33541         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
33542 }
33543
33544 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
33545         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33546         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
33547         return tag_ptr(ret_conv, true);
33548 }
33549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33550         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
33551         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
33552         return ret_conv;
33553 }
33554
33555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33556         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
33557         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33558         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
33559         return tag_ptr(ret_conv, true);
33560 }
33561
33562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
33563         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33564         *ret_conv = CResult_NonePaymentErrorZ_ok();
33565         return tag_ptr(ret_conv, true);
33566 }
33567
33568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33569         void* e_ptr = untag_ptr(e);
33570         CHECK_ACCESS(e_ptr);
33571         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
33572         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
33573         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33574         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
33575         return tag_ptr(ret_conv, true);
33576 }
33577
33578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33579         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
33580         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
33581         return ret_conv;
33582 }
33583
33584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33585         if (!ptr_is_owned(_res)) return;
33586         void* _res_ptr = untag_ptr(_res);
33587         CHECK_ACCESS(_res_ptr);
33588         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
33589         FREE(untag_ptr(_res));
33590         CResult_NonePaymentErrorZ_free(_res_conv);
33591 }
33592
33593 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
33594         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33595         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
33596         return tag_ptr(ret_conv, true);
33597 }
33598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33599         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
33600         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
33601         return ret_conv;
33602 }
33603
33604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33605         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
33606         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33607         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
33608         return tag_ptr(ret_conv, true);
33609 }
33610
33611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
33612         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
33613         o_constr.datalen = (*env)->GetArrayLength(env, o);
33614         if (o_constr.datalen > 0)
33615                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
33616         else
33617                 o_constr.data = NULL;
33618         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
33619         for (size_t o = 0; o < o_constr.datalen; o++) {
33620                 int64_t o_conv_40 = o_vals[o];
33621                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
33622                 CHECK_ACCESS(o_conv_40_ptr);
33623                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
33624                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
33625                 o_constr.data[o] = o_conv_40_conv;
33626         }
33627         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
33628         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33629         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
33630         return tag_ptr(ret_conv, true);
33631 }
33632
33633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33634         void* e_ptr = untag_ptr(e);
33635         CHECK_ACCESS(e_ptr);
33636         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
33637         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
33638         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33639         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
33640         return tag_ptr(ret_conv, true);
33641 }
33642
33643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33644         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
33645         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
33646         return ret_conv;
33647 }
33648
33649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33650         if (!ptr_is_owned(_res)) return;
33651         void* _res_ptr = untag_ptr(_res);
33652         CHECK_ACCESS(_res_ptr);
33653         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
33654         FREE(untag_ptr(_res));
33655         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
33656 }
33657
33658 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
33659         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33660         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
33661         return tag_ptr(ret_conv, true);
33662 }
33663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33664         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
33665         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
33666         return ret_conv;
33667 }
33668
33669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33670         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
33671         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33672         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
33673         return tag_ptr(ret_conv, true);
33674 }
33675
33676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
33677         LDKStr o_conv = java_to_owned_str(env, o);
33678         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33679         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
33680         return tag_ptr(ret_conv, true);
33681 }
33682
33683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33684         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
33685         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33686         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
33687         return tag_ptr(ret_conv, true);
33688 }
33689
33690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33691         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
33692         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
33693         return ret_conv;
33694 }
33695
33696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33697         if (!ptr_is_owned(_res)) return;
33698         void* _res_ptr = untag_ptr(_res);
33699         CHECK_ACCESS(_res_ptr);
33700         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
33701         FREE(untag_ptr(_res));
33702         CResult_StrSecp256k1ErrorZ_free(_res_conv);
33703 }
33704
33705 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
33706         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33707         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
33708         return tag_ptr(ret_conv, true);
33709 }
33710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33711         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
33712         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
33713         return ret_conv;
33714 }
33715
33716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33717         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
33718         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33719         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
33720         return tag_ptr(ret_conv, true);
33721 }
33722
33723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33724         void* o_ptr = untag_ptr(o);
33725         CHECK_ACCESS(o_ptr);
33726         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
33727         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
33728         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33729         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
33730         return tag_ptr(ret_conv, true);
33731 }
33732
33733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33734         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
33735         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33736         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
33737         return tag_ptr(ret_conv, true);
33738 }
33739
33740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33741         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
33742         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
33743         return ret_conv;
33744 }
33745
33746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33747         if (!ptr_is_owned(_res)) return;
33748         void* _res_ptr = untag_ptr(_res);
33749         CHECK_ACCESS(_res_ptr);
33750         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
33751         FREE(untag_ptr(_res));
33752         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
33753 }
33754
33755 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
33756         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33757         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
33758         return tag_ptr(ret_conv, true);
33759 }
33760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33761         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
33762         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
33763         return ret_conv;
33764 }
33765
33766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33767         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
33768         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33769         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
33770         return tag_ptr(ret_conv, true);
33771 }
33772
33773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33774         LDKOnionMessagePath o_conv;
33775         o_conv.inner = untag_ptr(o);
33776         o_conv.is_owned = ptr_is_owned(o);
33777         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33778         o_conv = OnionMessagePath_clone(&o_conv);
33779         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33780         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
33781         return tag_ptr(ret_conv, true);
33782 }
33783
33784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
33785         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33786         *ret_conv = CResult_OnionMessagePathNoneZ_err();
33787         return tag_ptr(ret_conv, true);
33788 }
33789
33790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33791         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
33792         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
33793         return ret_conv;
33794 }
33795
33796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33797         if (!ptr_is_owned(_res)) return;
33798         void* _res_ptr = untag_ptr(_res);
33799         CHECK_ACCESS(_res_ptr);
33800         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
33801         FREE(untag_ptr(_res));
33802         CResult_OnionMessagePathNoneZ_free(_res_conv);
33803 }
33804
33805 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
33806         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33807         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
33808         return tag_ptr(ret_conv, true);
33809 }
33810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33811         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
33812         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
33813         return ret_conv;
33814 }
33815
33816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33817         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
33818         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33819         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
33820         return tag_ptr(ret_conv, true);
33821 }
33822
33823 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
33824         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
33825         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
33826         return tag_ptr(ret_conv, true);
33827 }
33828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33829         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
33830         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
33831         return ret_conv;
33832 }
33833
33834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33835         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
33836         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
33837         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
33838         return tag_ptr(ret_conv, true);
33839 }
33840
33841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
33842         LDKPublicKey a_ref;
33843         CHECK((*env)->GetArrayLength(env, a) == 33);
33844         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
33845         LDKOnionMessage b_conv;
33846         b_conv.inner = untag_ptr(b);
33847         b_conv.is_owned = ptr_is_owned(b);
33848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33849         b_conv = OnionMessage_clone(&b_conv);
33850         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
33851         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
33852         return tag_ptr(ret_conv, true);
33853 }
33854
33855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33856         if (!ptr_is_owned(_res)) return;
33857         void* _res_ptr = untag_ptr(_res);
33858         CHECK_ACCESS(_res_ptr);
33859         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
33860         FREE(untag_ptr(_res));
33861         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
33862 }
33863
33864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33865         void* o_ptr = untag_ptr(o);
33866         CHECK_ACCESS(o_ptr);
33867         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
33868         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
33869         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
33870         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
33871         return tag_ptr(ret_conv, true);
33872 }
33873
33874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33875         void* e_ptr = untag_ptr(e);
33876         CHECK_ACCESS(e_ptr);
33877         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33878         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33879         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
33880         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
33881         return tag_ptr(ret_conv, true);
33882 }
33883
33884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33885         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
33886         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
33887         return ret_conv;
33888 }
33889
33890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33891         if (!ptr_is_owned(_res)) return;
33892         void* _res_ptr = untag_ptr(_res);
33893         CHECK_ACCESS(_res_ptr);
33894         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
33895         FREE(untag_ptr(_res));
33896         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
33897 }
33898
33899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
33900         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
33901         *ret_conv = CResult_NoneSendErrorZ_ok();
33902         return tag_ptr(ret_conv, true);
33903 }
33904
33905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33906         void* e_ptr = untag_ptr(e);
33907         CHECK_ACCESS(e_ptr);
33908         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33909         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33910         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
33911         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
33912         return tag_ptr(ret_conv, true);
33913 }
33914
33915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33916         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
33917         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
33918         return ret_conv;
33919 }
33920
33921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33922         if (!ptr_is_owned(_res)) return;
33923         void* _res_ptr = untag_ptr(_res);
33924         CHECK_ACCESS(_res_ptr);
33925         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
33926         FREE(untag_ptr(_res));
33927         CResult_NoneSendErrorZ_free(_res_conv);
33928 }
33929
33930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33931         LDKBlindedPath o_conv;
33932         o_conv.inner = untag_ptr(o);
33933         o_conv.is_owned = ptr_is_owned(o);
33934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33935         o_conv = BlindedPath_clone(&o_conv);
33936         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33937         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
33938         return tag_ptr(ret_conv, true);
33939 }
33940
33941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
33942         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33943         *ret_conv = CResult_BlindedPathNoneZ_err();
33944         return tag_ptr(ret_conv, true);
33945 }
33946
33947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33948         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
33949         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
33950         return ret_conv;
33951 }
33952
33953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33954         if (!ptr_is_owned(_res)) return;
33955         void* _res_ptr = untag_ptr(_res);
33956         CHECK_ACCESS(_res_ptr);
33957         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
33958         FREE(untag_ptr(_res));
33959         CResult_BlindedPathNoneZ_free(_res_conv);
33960 }
33961
33962 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
33963         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33964         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
33965         return tag_ptr(ret_conv, true);
33966 }
33967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33968         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
33969         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
33970         return ret_conv;
33971 }
33972
33973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33974         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
33975         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33976         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
33977         return tag_ptr(ret_conv, true);
33978 }
33979
33980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33981         void* o_ptr = untag_ptr(o);
33982         CHECK_ACCESS(o_ptr);
33983         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
33984         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
33985         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33986         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
33987         return tag_ptr(ret_conv, true);
33988 }
33989
33990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
33991         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33992         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
33993         return tag_ptr(ret_conv, true);
33994 }
33995
33996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33997         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
33998         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
33999         return ret_conv;
34000 }
34001
34002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34003         if (!ptr_is_owned(_res)) return;
34004         void* _res_ptr = untag_ptr(_res);
34005         CHECK_ACCESS(_res_ptr);
34006         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34007         FREE(untag_ptr(_res));
34008         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34009 }
34010
34011 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34012         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34013         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34014         return tag_ptr(ret_conv, true);
34015 }
34016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34017         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34018         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34019         return ret_conv;
34020 }
34021
34022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34023         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34024         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34025         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34026         return tag_ptr(ret_conv, true);
34027 }
34028
34029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34030         LDKBlindedPath o_conv;
34031         o_conv.inner = untag_ptr(o);
34032         o_conv.is_owned = ptr_is_owned(o);
34033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34034         o_conv = BlindedPath_clone(&o_conv);
34035         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34036         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34037         return tag_ptr(ret_conv, true);
34038 }
34039
34040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34041         void* e_ptr = untag_ptr(e);
34042         CHECK_ACCESS(e_ptr);
34043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34045         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34046         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34047         return tag_ptr(ret_conv, true);
34048 }
34049
34050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34051         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34052         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34053         return ret_conv;
34054 }
34055
34056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34057         if (!ptr_is_owned(_res)) return;
34058         void* _res_ptr = untag_ptr(_res);
34059         CHECK_ACCESS(_res_ptr);
34060         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34061         FREE(untag_ptr(_res));
34062         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34063 }
34064
34065 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34066         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34067         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34068         return tag_ptr(ret_conv, true);
34069 }
34070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34071         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34072         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34073         return ret_conv;
34074 }
34075
34076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34077         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34078         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34079         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34080         return tag_ptr(ret_conv, true);
34081 }
34082
34083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34084         LDKBlindedHop o_conv;
34085         o_conv.inner = untag_ptr(o);
34086         o_conv.is_owned = ptr_is_owned(o);
34087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34088         o_conv = BlindedHop_clone(&o_conv);
34089         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34090         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34091         return tag_ptr(ret_conv, true);
34092 }
34093
34094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34095         void* e_ptr = untag_ptr(e);
34096         CHECK_ACCESS(e_ptr);
34097         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34098         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34099         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34100         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34101         return tag_ptr(ret_conv, true);
34102 }
34103
34104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34105         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34106         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34107         return ret_conv;
34108 }
34109
34110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34111         if (!ptr_is_owned(_res)) return;
34112         void* _res_ptr = untag_ptr(_res);
34113         CHECK_ACCESS(_res_ptr);
34114         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34115         FREE(untag_ptr(_res));
34116         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34117 }
34118
34119 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34120         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34121         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34122         return tag_ptr(ret_conv, true);
34123 }
34124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34125         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34126         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34127         return ret_conv;
34128 }
34129
34130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34131         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34132         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34133         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34134         return tag_ptr(ret_conv, true);
34135 }
34136
34137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34138         LDKInvoiceError o_conv;
34139         o_conv.inner = untag_ptr(o);
34140         o_conv.is_owned = ptr_is_owned(o);
34141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34142         o_conv = InvoiceError_clone(&o_conv);
34143         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34144         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34145         return tag_ptr(ret_conv, true);
34146 }
34147
34148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34149         void* e_ptr = untag_ptr(e);
34150         CHECK_ACCESS(e_ptr);
34151         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34152         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34153         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34154         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34155         return tag_ptr(ret_conv, true);
34156 }
34157
34158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34159         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34160         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34161         return ret_conv;
34162 }
34163
34164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34165         if (!ptr_is_owned(_res)) return;
34166         void* _res_ptr = untag_ptr(_res);
34167         CHECK_ACCESS(_res_ptr);
34168         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34169         FREE(untag_ptr(_res));
34170         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34171 }
34172
34173 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34174         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34175         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34176         return tag_ptr(ret_conv, true);
34177 }
34178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34179         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34180         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34181         return ret_conv;
34182 }
34183
34184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34185         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34186         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34187         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34188         return tag_ptr(ret_conv, true);
34189 }
34190
34191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34192         void* o_ptr = untag_ptr(o);
34193         CHECK_ACCESS(o_ptr);
34194         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34195         if (o_conv.free == LDKFilter_JCalls_free) {
34196                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34197                 LDKFilter_JCalls_cloned(&o_conv);
34198         }
34199         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34200         *ret_copy = COption_FilterZ_some(o_conv);
34201         int64_t ret_ref = tag_ptr(ret_copy, true);
34202         return ret_ref;
34203 }
34204
34205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
34206         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34207         *ret_copy = COption_FilterZ_none();
34208         int64_t ret_ref = tag_ptr(ret_copy, true);
34209         return ret_ref;
34210 }
34211
34212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34213         if (!ptr_is_owned(_res)) return;
34214         void* _res_ptr = untag_ptr(_res);
34215         CHECK_ACCESS(_res_ptr);
34216         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34217         FREE(untag_ptr(_res));
34218         COption_FilterZ_free(_res_conv);
34219 }
34220
34221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34222         LDKLockedChannelMonitor o_conv;
34223         o_conv.inner = untag_ptr(o);
34224         o_conv.is_owned = ptr_is_owned(o);
34225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34226         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34227         
34228         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34229         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34230         return tag_ptr(ret_conv, true);
34231 }
34232
34233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
34234         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34235         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34236         return tag_ptr(ret_conv, true);
34237 }
34238
34239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34240         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34241         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34242         return ret_conv;
34243 }
34244
34245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34246         if (!ptr_is_owned(_res)) return;
34247         void* _res_ptr = untag_ptr(_res);
34248         CHECK_ACCESS(_res_ptr);
34249         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34250         FREE(untag_ptr(_res));
34251         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34252 }
34253
34254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34255         LDKCVec_OutPointZ _res_constr;
34256         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34257         if (_res_constr.datalen > 0)
34258                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
34259         else
34260                 _res_constr.data = NULL;
34261         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34262         for (size_t k = 0; k < _res_constr.datalen; k++) {
34263                 int64_t _res_conv_10 = _res_vals[k];
34264                 LDKOutPoint _res_conv_10_conv;
34265                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
34266                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
34267                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
34268                 _res_constr.data[k] = _res_conv_10_conv;
34269         }
34270         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34271         CVec_OutPointZ_free(_res_constr);
34272 }
34273
34274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34275         LDKCVec_MonitorUpdateIdZ _res_constr;
34276         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34277         if (_res_constr.datalen > 0)
34278                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34279         else
34280                 _res_constr.data = NULL;
34281         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34282         for (size_t r = 0; r < _res_constr.datalen; r++) {
34283                 int64_t _res_conv_17 = _res_vals[r];
34284                 LDKMonitorUpdateId _res_conv_17_conv;
34285                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
34286                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
34287                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
34288                 _res_constr.data[r] = _res_conv_17_conv;
34289         }
34290         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34291         CVec_MonitorUpdateIdZ_free(_res_constr);
34292 }
34293
34294 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
34295         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34296         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
34297         return tag_ptr(ret_conv, true);
34298 }
34299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34300         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
34301         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
34302         return ret_conv;
34303 }
34304
34305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34306         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
34307         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34308         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
34309         return tag_ptr(ret_conv, true);
34310 }
34311
34312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
34313         LDKOutPoint a_conv;
34314         a_conv.inner = untag_ptr(a);
34315         a_conv.is_owned = ptr_is_owned(a);
34316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34317         a_conv = OutPoint_clone(&a_conv);
34318         LDKCVec_MonitorUpdateIdZ b_constr;
34319         b_constr.datalen = (*env)->GetArrayLength(env, b);
34320         if (b_constr.datalen > 0)
34321                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34322         else
34323                 b_constr.data = NULL;
34324         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
34325         for (size_t r = 0; r < b_constr.datalen; r++) {
34326                 int64_t b_conv_17 = b_vals[r];
34327                 LDKMonitorUpdateId b_conv_17_conv;
34328                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
34329                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
34330                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
34331                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
34332                 b_constr.data[r] = b_conv_17_conv;
34333         }
34334         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
34335         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34336         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
34337         return tag_ptr(ret_conv, true);
34338 }
34339
34340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34341         if (!ptr_is_owned(_res)) return;
34342         void* _res_ptr = untag_ptr(_res);
34343         CHECK_ACCESS(_res_ptr);
34344         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
34345         FREE(untag_ptr(_res));
34346         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
34347 }
34348
34349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34350         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
34351         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34352         if (_res_constr.datalen > 0)
34353                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
34354         else
34355                 _res_constr.data = NULL;
34356         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34357         for (size_t p = 0; p < _res_constr.datalen; p++) {
34358                 int64_t _res_conv_41 = _res_vals[p];
34359                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
34360                 CHECK_ACCESS(_res_conv_41_ptr);
34361                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
34362                 FREE(untag_ptr(_res_conv_41));
34363                 _res_constr.data[p] = _res_conv_41_conv;
34364         }
34365         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34366         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
34367 }
34368
34369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34370         if (!ptr_is_owned(this_ptr)) return;
34371         void* this_ptr_ptr = untag_ptr(this_ptr);
34372         CHECK_ACCESS(this_ptr_ptr);
34373         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
34374         FREE(untag_ptr(this_ptr));
34375         APIError_free(this_ptr_conv);
34376 }
34377
34378 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
34379         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34380         *ret_copy = APIError_clone(arg);
34381         int64_t ret_ref = tag_ptr(ret_copy, true);
34382         return ret_ref;
34383 }
34384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34385         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
34386         int64_t ret_conv = APIError_clone_ptr(arg_conv);
34387         return ret_conv;
34388 }
34389
34390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34391         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
34392         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34393         *ret_copy = APIError_clone(orig_conv);
34394         int64_t ret_ref = tag_ptr(ret_copy, true);
34395         return ret_ref;
34396 }
34397
34398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
34399         LDKStr err_conv = java_to_owned_str(env, err);
34400         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34401         *ret_copy = APIError_apimisuse_error(err_conv);
34402         int64_t ret_ref = tag_ptr(ret_copy, true);
34403         return ret_ref;
34404 }
34405
34406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
34407         LDKStr err_conv = java_to_owned_str(env, err);
34408         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34409         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
34410         int64_t ret_ref = tag_ptr(ret_copy, true);
34411         return ret_ref;
34412 }
34413
34414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
34415         LDKStr err_conv = java_to_owned_str(env, err);
34416         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34417         *ret_copy = APIError_invalid_route(err_conv);
34418         int64_t ret_ref = tag_ptr(ret_copy, true);
34419         return ret_ref;
34420 }
34421
34422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
34423         LDKStr err_conv = java_to_owned_str(env, err);
34424         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34425         *ret_copy = APIError_channel_unavailable(err_conv);
34426         int64_t ret_ref = tag_ptr(ret_copy, true);
34427         return ret_ref;
34428 }
34429
34430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
34431         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34432         *ret_copy = APIError_monitor_update_in_progress();
34433         int64_t ret_ref = tag_ptr(ret_copy, true);
34434         return ret_ref;
34435 }
34436
34437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
34438         LDKShutdownScript script_conv;
34439         script_conv.inner = untag_ptr(script);
34440         script_conv.is_owned = ptr_is_owned(script);
34441         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
34442         script_conv = ShutdownScript_clone(&script_conv);
34443         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34444         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
34445         int64_t ret_ref = tag_ptr(ret_copy, true);
34446         return ret_ref;
34447 }
34448
34449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34450         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
34451         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
34452         jboolean ret_conv = APIError_eq(a_conv, b_conv);
34453         return ret_conv;
34454 }
34455
34456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
34457         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
34458         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
34459         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34460         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34461         CVec_u8Z_free(ret_var);
34462         return ret_arr;
34463 }
34464
34465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34466         LDKu8slice ser_ref;
34467         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34468         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34469         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
34470         *ret_conv = APIError_read(ser_ref);
34471         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34472         return tag_ptr(ret_conv, true);
34473 }
34474
34475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34476         LDKBigSize this_obj_conv;
34477         this_obj_conv.inner = untag_ptr(this_obj);
34478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34480         BigSize_free(this_obj_conv);
34481 }
34482
34483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
34484         LDKBigSize this_ptr_conv;
34485         this_ptr_conv.inner = untag_ptr(this_ptr);
34486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34488         this_ptr_conv.is_owned = false;
34489         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
34490         return ret_conv;
34491 }
34492
34493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34494         LDKBigSize this_ptr_conv;
34495         this_ptr_conv.inner = untag_ptr(this_ptr);
34496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34498         this_ptr_conv.is_owned = false;
34499         BigSize_set_a(&this_ptr_conv, val);
34500 }
34501
34502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
34503         LDKBigSize ret_var = BigSize_new(a_arg);
34504         int64_t ret_ref = 0;
34505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34507         return ret_ref;
34508 }
34509
34510 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
34511         LDKBigSize ret_var = BigSize_clone(arg);
34512         int64_t ret_ref = 0;
34513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34515         return ret_ref;
34516 }
34517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34518         LDKBigSize arg_conv;
34519         arg_conv.inner = untag_ptr(arg);
34520         arg_conv.is_owned = ptr_is_owned(arg);
34521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34522         arg_conv.is_owned = false;
34523         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
34524         return ret_conv;
34525 }
34526
34527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34528         LDKBigSize orig_conv;
34529         orig_conv.inner = untag_ptr(orig);
34530         orig_conv.is_owned = ptr_is_owned(orig);
34531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34532         orig_conv.is_owned = false;
34533         LDKBigSize ret_var = BigSize_clone(&orig_conv);
34534         int64_t ret_ref = 0;
34535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34537         return ret_ref;
34538 }
34539
34540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
34541         LDKBigSize o_conv;
34542         o_conv.inner = untag_ptr(o);
34543         o_conv.is_owned = ptr_is_owned(o);
34544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34545         o_conv.is_owned = false;
34546         int64_t ret_conv = BigSize_hash(&o_conv);
34547         return ret_conv;
34548 }
34549
34550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34551         LDKBigSize a_conv;
34552         a_conv.inner = untag_ptr(a);
34553         a_conv.is_owned = ptr_is_owned(a);
34554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34555         a_conv.is_owned = false;
34556         LDKBigSize b_conv;
34557         b_conv.inner = untag_ptr(b);
34558         b_conv.is_owned = ptr_is_owned(b);
34559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34560         b_conv.is_owned = false;
34561         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
34562         return ret_conv;
34563 }
34564
34565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
34566         LDKBigSize obj_conv;
34567         obj_conv.inner = untag_ptr(obj);
34568         obj_conv.is_owned = ptr_is_owned(obj);
34569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34570         obj_conv.is_owned = false;
34571         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
34572         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34573         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34574         CVec_u8Z_free(ret_var);
34575         return ret_arr;
34576 }
34577
34578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34579         LDKu8slice ser_ref;
34580         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34581         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34582         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
34583         *ret_conv = BigSize_read(ser_ref);
34584         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34585         return tag_ptr(ret_conv, true);
34586 }
34587
34588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34589         LDKHostname this_obj_conv;
34590         this_obj_conv.inner = untag_ptr(this_obj);
34591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34593         Hostname_free(this_obj_conv);
34594 }
34595
34596 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
34597         LDKHostname ret_var = Hostname_clone(arg);
34598         int64_t ret_ref = 0;
34599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34601         return ret_ref;
34602 }
34603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34604         LDKHostname arg_conv;
34605         arg_conv.inner = untag_ptr(arg);
34606         arg_conv.is_owned = ptr_is_owned(arg);
34607         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34608         arg_conv.is_owned = false;
34609         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
34610         return ret_conv;
34611 }
34612
34613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34614         LDKHostname orig_conv;
34615         orig_conv.inner = untag_ptr(orig);
34616         orig_conv.is_owned = ptr_is_owned(orig);
34617         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34618         orig_conv.is_owned = false;
34619         LDKHostname ret_var = Hostname_clone(&orig_conv);
34620         int64_t ret_ref = 0;
34621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34623         return ret_ref;
34624 }
34625
34626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34627         LDKHostname a_conv;
34628         a_conv.inner = untag_ptr(a);
34629         a_conv.is_owned = ptr_is_owned(a);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34631         a_conv.is_owned = false;
34632         LDKHostname b_conv;
34633         b_conv.inner = untag_ptr(b);
34634         b_conv.is_owned = ptr_is_owned(b);
34635         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34636         b_conv.is_owned = false;
34637         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
34638         return ret_conv;
34639 }
34640
34641 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
34642         LDKHostname this_arg_conv;
34643         this_arg_conv.inner = untag_ptr(this_arg);
34644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34646         this_arg_conv.is_owned = false;
34647         int8_t ret_conv = Hostname_len(&this_arg_conv);
34648         return ret_conv;
34649 }
34650
34651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
34652         LDKHostname obj_conv;
34653         obj_conv.inner = untag_ptr(obj);
34654         obj_conv.is_owned = ptr_is_owned(obj);
34655         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34656         obj_conv.is_owned = false;
34657         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
34658         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34659         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34660         CVec_u8Z_free(ret_var);
34661         return ret_arr;
34662 }
34663
34664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34665         LDKu8slice ser_ref;
34666         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34667         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34668         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
34669         *ret_conv = Hostname_read(ser_ref);
34670         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34671         return tag_ptr(ret_conv, true);
34672 }
34673
34674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34675         LDKTransactionU16LenLimited this_obj_conv;
34676         this_obj_conv.inner = untag_ptr(this_obj);
34677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34679         TransactionU16LenLimited_free(this_obj_conv);
34680 }
34681
34682 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
34683         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
34684         int64_t ret_ref = 0;
34685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34687         return ret_ref;
34688 }
34689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34690         LDKTransactionU16LenLimited arg_conv;
34691         arg_conv.inner = untag_ptr(arg);
34692         arg_conv.is_owned = ptr_is_owned(arg);
34693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34694         arg_conv.is_owned = false;
34695         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
34696         return ret_conv;
34697 }
34698
34699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34700         LDKTransactionU16LenLimited orig_conv;
34701         orig_conv.inner = untag_ptr(orig);
34702         orig_conv.is_owned = ptr_is_owned(orig);
34703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34704         orig_conv.is_owned = false;
34705         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
34706         int64_t ret_ref = 0;
34707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34709         return ret_ref;
34710 }
34711
34712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34713         LDKTransactionU16LenLimited a_conv;
34714         a_conv.inner = untag_ptr(a);
34715         a_conv.is_owned = ptr_is_owned(a);
34716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34717         a_conv.is_owned = false;
34718         LDKTransactionU16LenLimited b_conv;
34719         b_conv.inner = untag_ptr(b);
34720         b_conv.is_owned = ptr_is_owned(b);
34721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34722         b_conv.is_owned = false;
34723         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
34724         return ret_conv;
34725 }
34726
34727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
34728         LDKTransaction transaction_ref;
34729         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
34730         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
34731         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
34732         transaction_ref.data_is_owned = true;
34733         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
34734         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
34735         return tag_ptr(ret_conv, true);
34736 }
34737
34738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
34739         LDKTransactionU16LenLimited this_arg_conv;
34740         this_arg_conv.inner = untag_ptr(this_arg);
34741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34743         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
34744         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
34745         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34746         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34747         Transaction_free(ret_var);
34748         return ret_arr;
34749 }
34750
34751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
34752         LDKTransactionU16LenLimited obj_conv;
34753         obj_conv.inner = untag_ptr(obj);
34754         obj_conv.is_owned = ptr_is_owned(obj);
34755         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34756         obj_conv.is_owned = false;
34757         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
34758         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34759         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34760         CVec_u8Z_free(ret_var);
34761         return ret_arr;
34762 }
34763
34764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34765         LDKu8slice ser_ref;
34766         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34767         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34768         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
34769         *ret_conv = TransactionU16LenLimited_read(ser_ref);
34770         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34771         return tag_ptr(ret_conv, true);
34772 }
34773
34774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
34775         LDKu8slice msg_ref;
34776         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
34777         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
34778         uint8_t sk_arr[32];
34779         CHECK((*env)->GetArrayLength(env, sk) == 32);
34780         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
34781         uint8_t (*sk_ref)[32] = &sk_arr;
34782         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34783         *ret_conv = sign(msg_ref, sk_ref);
34784         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
34785         return tag_ptr(ret_conv, true);
34786 }
34787
34788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
34789         LDKu8slice msg_ref;
34790         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
34791         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
34792         LDKStr sig_conv = java_to_owned_str(env, sig);
34793         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
34794         *ret_conv = recover_pk(msg_ref, sig_conv);
34795         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
34796         return tag_ptr(ret_conv, true);
34797 }
34798
34799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
34800         LDKu8slice msg_ref;
34801         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
34802         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
34803         LDKStr sig_conv = java_to_owned_str(env, sig);
34804         LDKPublicKey pk_ref;
34805         CHECK((*env)->GetArrayLength(env, pk) == 33);
34806         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
34807         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
34808         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
34809         return ret_conv;
34810 }
34811
34812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
34813         LDKu8slice hrp_bytes_ref;
34814         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
34815         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
34816         LDKCVec_U5Z data_without_signature_constr;
34817         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
34818         if (data_without_signature_constr.datalen > 0)
34819                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
34820         else
34821                 data_without_signature_constr.data = NULL;
34822         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
34823         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
34824                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
34825                 
34826                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
34827         }
34828         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
34829         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
34830         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34831         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34832         CVec_u8Z_free(ret_var);
34833         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
34834         return ret_arr;
34835 }
34836
34837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34838         if (!ptr_is_owned(this_ptr)) return;
34839         void* this_ptr_ptr = untag_ptr(this_ptr);
34840         CHECK_ACCESS(this_ptr_ptr);
34841         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
34842         FREE(untag_ptr(this_ptr));
34843         KVStore_free(this_ptr_conv);
34844 }
34845
34846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34847         if (!ptr_is_owned(this_ptr)) return;
34848         void* this_ptr_ptr = untag_ptr(this_ptr);
34849         CHECK_ACCESS(this_ptr_ptr);
34850         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
34851         FREE(untag_ptr(this_ptr));
34852         Persister_free(this_ptr_conv);
34853 }
34854
34855 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) {
34856         void* kv_store_ptr = untag_ptr(kv_store);
34857         CHECK_ACCESS(kv_store_ptr);
34858         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
34859         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
34860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34861                 LDKKVStore_JCalls_cloned(&kv_store_conv);
34862         }
34863         void* entropy_source_ptr = untag_ptr(entropy_source);
34864         CHECK_ACCESS(entropy_source_ptr);
34865         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34866         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34868                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34869         }
34870         void* signer_provider_ptr = untag_ptr(signer_provider);
34871         CHECK_ACCESS(signer_provider_ptr);
34872         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34873         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34874                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34875                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34876         }
34877         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
34878         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
34879         return tag_ptr(ret_conv, true);
34880 }
34881
34882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34883         LDKMonitorUpdatingPersister this_obj_conv;
34884         this_obj_conv.inner = untag_ptr(this_obj);
34885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34887         MonitorUpdatingPersister_free(this_obj_conv);
34888 }
34889
34890 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) {
34891         void* kv_store_ptr = untag_ptr(kv_store);
34892         CHECK_ACCESS(kv_store_ptr);
34893         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
34894         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
34895                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34896                 LDKKVStore_JCalls_cloned(&kv_store_conv);
34897         }
34898         void* logger_ptr = untag_ptr(logger);
34899         CHECK_ACCESS(logger_ptr);
34900         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34901         if (logger_conv.free == LDKLogger_JCalls_free) {
34902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34903                 LDKLogger_JCalls_cloned(&logger_conv);
34904         }
34905         void* entropy_source_ptr = untag_ptr(entropy_source);
34906         CHECK_ACCESS(entropy_source_ptr);
34907         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34908         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34909                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34910                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34911         }
34912         void* signer_provider_ptr = untag_ptr(signer_provider);
34913         CHECK_ACCESS(signer_provider_ptr);
34914         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34915         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34916                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34917                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34918         }
34919         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
34920         int64_t ret_ref = 0;
34921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34923         return ret_ref;
34924 }
34925
34926 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) {
34927         LDKMonitorUpdatingPersister this_arg_conv;
34928         this_arg_conv.inner = untag_ptr(this_arg);
34929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34931         this_arg_conv.is_owned = false;
34932         void* broadcaster_ptr = untag_ptr(broadcaster);
34933         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
34934         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
34935         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34936         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
34937         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
34938         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
34939         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
34940         return tag_ptr(ret_conv, true);
34941 }
34942
34943 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) {
34944         LDKMonitorUpdatingPersister this_arg_conv;
34945         this_arg_conv.inner = untag_ptr(this_arg);
34946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34948         this_arg_conv.is_owned = false;
34949         void* broadcaster_ptr = untag_ptr(broadcaster);
34950         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
34951         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
34952         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34953         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
34954         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
34955         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
34956         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
34957         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
34958         return tag_ptr(ret_conv, true);
34959 }
34960
34961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
34962         LDKMonitorUpdatingPersister this_arg_conv;
34963         this_arg_conv.inner = untag_ptr(this_arg);
34964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34966         this_arg_conv.is_owned = false;
34967         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
34968         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
34969         return tag_ptr(ret_conv, true);
34970 }
34971
34972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
34973         LDKMonitorUpdatingPersister this_arg_conv;
34974         this_arg_conv.inner = untag_ptr(this_arg);
34975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34977         this_arg_conv.is_owned = false;
34978         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
34979         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
34980         return tag_ptr(ret_ret, true);
34981 }
34982
34983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34984         LDKUntrustedString this_obj_conv;
34985         this_obj_conv.inner = untag_ptr(this_obj);
34986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34988         UntrustedString_free(this_obj_conv);
34989 }
34990
34991 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
34992         LDKUntrustedString this_ptr_conv;
34993         this_ptr_conv.inner = untag_ptr(this_ptr);
34994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34996         this_ptr_conv.is_owned = false;
34997         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
34998         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34999         Str_free(ret_str);
35000         return ret_conv;
35001 }
35002
35003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35004         LDKUntrustedString this_ptr_conv;
35005         this_ptr_conv.inner = untag_ptr(this_ptr);
35006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35008         this_ptr_conv.is_owned = false;
35009         LDKStr val_conv = java_to_owned_str(env, val);
35010         UntrustedString_set_a(&this_ptr_conv, val_conv);
35011 }
35012
35013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35014         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35015         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35016         int64_t ret_ref = 0;
35017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35019         return ret_ref;
35020 }
35021
35022 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35023         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35024         int64_t ret_ref = 0;
35025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35027         return ret_ref;
35028 }
35029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35030         LDKUntrustedString arg_conv;
35031         arg_conv.inner = untag_ptr(arg);
35032         arg_conv.is_owned = ptr_is_owned(arg);
35033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35034         arg_conv.is_owned = false;
35035         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35036         return ret_conv;
35037 }
35038
35039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35040         LDKUntrustedString orig_conv;
35041         orig_conv.inner = untag_ptr(orig);
35042         orig_conv.is_owned = ptr_is_owned(orig);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35044         orig_conv.is_owned = false;
35045         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35046         int64_t ret_ref = 0;
35047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35049         return ret_ref;
35050 }
35051
35052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35053         LDKUntrustedString a_conv;
35054         a_conv.inner = untag_ptr(a);
35055         a_conv.is_owned = ptr_is_owned(a);
35056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35057         a_conv.is_owned = false;
35058         LDKUntrustedString b_conv;
35059         b_conv.inner = untag_ptr(b);
35060         b_conv.is_owned = ptr_is_owned(b);
35061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35062         b_conv.is_owned = false;
35063         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35064         return ret_conv;
35065 }
35066
35067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
35068         LDKUntrustedString obj_conv;
35069         obj_conv.inner = untag_ptr(obj);
35070         obj_conv.is_owned = ptr_is_owned(obj);
35071         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35072         obj_conv.is_owned = false;
35073         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35074         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35075         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35076         CVec_u8Z_free(ret_var);
35077         return ret_arr;
35078 }
35079
35080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35081         LDKu8slice ser_ref;
35082         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35083         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35084         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35085         *ret_conv = UntrustedString_read(ser_ref);
35086         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35087         return tag_ptr(ret_conv, true);
35088 }
35089
35090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35091         LDKPrintableString this_obj_conv;
35092         this_obj_conv.inner = untag_ptr(this_obj);
35093         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35095         PrintableString_free(this_obj_conv);
35096 }
35097
35098 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35099         LDKPrintableString this_ptr_conv;
35100         this_ptr_conv.inner = untag_ptr(this_ptr);
35101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35103         this_ptr_conv.is_owned = false;
35104         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35105         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35106         Str_free(ret_str);
35107         return ret_conv;
35108 }
35109
35110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35111         LDKPrintableString this_ptr_conv;
35112         this_ptr_conv.inner = untag_ptr(this_ptr);
35113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35115         this_ptr_conv.is_owned = false;
35116         LDKStr val_conv = java_to_owned_str(env, val);
35117         PrintableString_set_a(&this_ptr_conv, val_conv);
35118 }
35119
35120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35121         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35122         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35123         int64_t ret_ref = 0;
35124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35126         return ret_ref;
35127 }
35128
35129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35130         if (!ptr_is_owned(this_ptr)) return;
35131         void* this_ptr_ptr = untag_ptr(this_ptr);
35132         CHECK_ACCESS(this_ptr_ptr);
35133         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
35134         FREE(untag_ptr(this_ptr));
35135         FutureCallback_free(this_ptr_conv);
35136 }
35137
35138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35139         LDKFuture this_obj_conv;
35140         this_obj_conv.inner = untag_ptr(this_obj);
35141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35143         Future_free(this_obj_conv);
35144 }
35145
35146 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
35147         LDKFuture ret_var = Future_clone(arg);
35148         int64_t ret_ref = 0;
35149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35151         return ret_ref;
35152 }
35153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35154         LDKFuture arg_conv;
35155         arg_conv.inner = untag_ptr(arg);
35156         arg_conv.is_owned = ptr_is_owned(arg);
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35158         arg_conv.is_owned = false;
35159         int64_t ret_conv = Future_clone_ptr(&arg_conv);
35160         return ret_conv;
35161 }
35162
35163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35164         LDKFuture orig_conv;
35165         orig_conv.inner = untag_ptr(orig);
35166         orig_conv.is_owned = ptr_is_owned(orig);
35167         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35168         orig_conv.is_owned = false;
35169         LDKFuture ret_var = Future_clone(&orig_conv);
35170         int64_t ret_ref = 0;
35171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35173         return ret_ref;
35174 }
35175
35176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
35177         LDKFuture this_arg_conv;
35178         this_arg_conv.inner = untag_ptr(this_arg);
35179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35181         this_arg_conv.is_owned = false;
35182         void* callback_ptr = untag_ptr(callback);
35183         CHECK_ACCESS(callback_ptr);
35184         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
35185         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
35186                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35187                 LDKFutureCallback_JCalls_cloned(&callback_conv);
35188         }
35189         Future_register_callback_fn(&this_arg_conv, callback_conv);
35190 }
35191
35192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35193         LDKFuture this_arg_conv;
35194         this_arg_conv.inner = untag_ptr(this_arg);
35195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35197         this_arg_conv = Future_clone(&this_arg_conv);
35198         Future_wait(this_arg_conv);
35199 }
35200
35201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35202         LDKFuture this_arg_conv;
35203         this_arg_conv.inner = untag_ptr(this_arg);
35204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35206         this_arg_conv = Future_clone(&this_arg_conv);
35207         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
35208         return ret_conv;
35209 }
35210
35211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35212         LDKSleeper this_obj_conv;
35213         this_obj_conv.inner = untag_ptr(this_obj);
35214         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35216         Sleeper_free(this_obj_conv);
35217 }
35218
35219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
35220         LDKFuture future_conv;
35221         future_conv.inner = untag_ptr(future);
35222         future_conv.is_owned = ptr_is_owned(future);
35223         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
35224         future_conv = Future_clone(&future_conv);
35225         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
35226         int64_t ret_ref = 0;
35227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35229         return ret_ref;
35230 }
35231
35232 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) {
35233         LDKFuture fut_a_conv;
35234         fut_a_conv.inner = untag_ptr(fut_a);
35235         fut_a_conv.is_owned = ptr_is_owned(fut_a);
35236         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
35237         fut_a_conv = Future_clone(&fut_a_conv);
35238         LDKFuture fut_b_conv;
35239         fut_b_conv.inner = untag_ptr(fut_b);
35240         fut_b_conv.is_owned = ptr_is_owned(fut_b);
35241         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
35242         fut_b_conv = Future_clone(&fut_b_conv);
35243         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
35244         int64_t ret_ref = 0;
35245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35247         return ret_ref;
35248 }
35249
35250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
35251         LDKCVec_FutureZ futures_constr;
35252         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
35253         if (futures_constr.datalen > 0)
35254                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
35255         else
35256                 futures_constr.data = NULL;
35257         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
35258         for (size_t i = 0; i < futures_constr.datalen; i++) {
35259                 int64_t futures_conv_8 = futures_vals[i];
35260                 LDKFuture futures_conv_8_conv;
35261                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
35262                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
35263                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
35264                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
35265                 futures_constr.data[i] = futures_conv_8_conv;
35266         }
35267         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
35268         LDKSleeper ret_var = Sleeper_new(futures_constr);
35269         int64_t ret_ref = 0;
35270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35272         return ret_ref;
35273 }
35274
35275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35276         LDKSleeper this_arg_conv;
35277         this_arg_conv.inner = untag_ptr(this_arg);
35278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35280         this_arg_conv.is_owned = false;
35281         Sleeper_wait(&this_arg_conv);
35282 }
35283
35284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35285         LDKSleeper this_arg_conv;
35286         this_arg_conv.inner = untag_ptr(this_arg);
35287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35289         this_arg_conv.is_owned = false;
35290         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
35291         return ret_conv;
35292 }
35293
35294 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35295         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
35296         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
35297         return ret_conv;
35298 }
35299
35300 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
35301         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
35302         return ret_conv;
35303 }
35304
35305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
35306         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
35307         return ret_conv;
35308 }
35309
35310 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
35311         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
35312         return ret_conv;
35313 }
35314
35315 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
35316         jclass ret_conv = LDKLevel_to_java(env, Level_info());
35317         return ret_conv;
35318 }
35319
35320 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
35321         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
35322         return ret_conv;
35323 }
35324
35325 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
35326         jclass ret_conv = LDKLevel_to_java(env, Level_error());
35327         return ret_conv;
35328 }
35329
35330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35331         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
35332         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
35333         jboolean ret_conv = Level_eq(a_conv, b_conv);
35334         return ret_conv;
35335 }
35336
35337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
35338         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
35339         int64_t ret_conv = Level_hash(o_conv);
35340         return ret_conv;
35341 }
35342
35343 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
35344         jclass ret_conv = LDKLevel_to_java(env, Level_max());
35345         return ret_conv;
35346 }
35347
35348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35349         LDKRecord this_obj_conv;
35350         this_obj_conv.inner = untag_ptr(this_obj);
35351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35353         Record_free(this_obj_conv);
35354 }
35355
35356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
35357         LDKRecord this_ptr_conv;
35358         this_ptr_conv.inner = untag_ptr(this_ptr);
35359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35361         this_ptr_conv.is_owned = false;
35362         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
35363         return ret_conv;
35364 }
35365
35366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
35367         LDKRecord this_ptr_conv;
35368         this_ptr_conv.inner = untag_ptr(this_ptr);
35369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35371         this_ptr_conv.is_owned = false;
35372         LDKLevel val_conv = LDKLevel_from_java(env, val);
35373         Record_set_level(&this_ptr_conv, val_conv);
35374 }
35375
35376 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
35377         LDKRecord this_ptr_conv;
35378         this_ptr_conv.inner = untag_ptr(this_ptr);
35379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35381         this_ptr_conv.is_owned = false;
35382         LDKStr ret_str = Record_get_args(&this_ptr_conv);
35383         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35384         Str_free(ret_str);
35385         return ret_conv;
35386 }
35387
35388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35389         LDKRecord this_ptr_conv;
35390         this_ptr_conv.inner = untag_ptr(this_ptr);
35391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35393         this_ptr_conv.is_owned = false;
35394         LDKStr val_conv = java_to_owned_str(env, val);
35395         Record_set_args(&this_ptr_conv, val_conv);
35396 }
35397
35398 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
35399         LDKRecord this_ptr_conv;
35400         this_ptr_conv.inner = untag_ptr(this_ptr);
35401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35403         this_ptr_conv.is_owned = false;
35404         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
35405         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35406         Str_free(ret_str);
35407         return ret_conv;
35408 }
35409
35410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35411         LDKRecord this_ptr_conv;
35412         this_ptr_conv.inner = untag_ptr(this_ptr);
35413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35415         this_ptr_conv.is_owned = false;
35416         LDKStr val_conv = java_to_owned_str(env, val);
35417         Record_set_module_path(&this_ptr_conv, val_conv);
35418 }
35419
35420 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
35421         LDKRecord this_ptr_conv;
35422         this_ptr_conv.inner = untag_ptr(this_ptr);
35423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35425         this_ptr_conv.is_owned = false;
35426         LDKStr ret_str = Record_get_file(&this_ptr_conv);
35427         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35428         Str_free(ret_str);
35429         return ret_conv;
35430 }
35431
35432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35433         LDKRecord this_ptr_conv;
35434         this_ptr_conv.inner = untag_ptr(this_ptr);
35435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35437         this_ptr_conv.is_owned = false;
35438         LDKStr val_conv = java_to_owned_str(env, val);
35439         Record_set_file(&this_ptr_conv, val_conv);
35440 }
35441
35442 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
35443         LDKRecord this_ptr_conv;
35444         this_ptr_conv.inner = untag_ptr(this_ptr);
35445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35447         this_ptr_conv.is_owned = false;
35448         int32_t ret_conv = Record_get_line(&this_ptr_conv);
35449         return ret_conv;
35450 }
35451
35452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35453         LDKRecord this_ptr_conv;
35454         this_ptr_conv.inner = untag_ptr(this_ptr);
35455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35457         this_ptr_conv.is_owned = false;
35458         Record_set_line(&this_ptr_conv, val);
35459 }
35460
35461 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
35462         LDKRecord ret_var = Record_clone(arg);
35463         int64_t ret_ref = 0;
35464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35466         return ret_ref;
35467 }
35468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35469         LDKRecord arg_conv;
35470         arg_conv.inner = untag_ptr(arg);
35471         arg_conv.is_owned = ptr_is_owned(arg);
35472         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35473         arg_conv.is_owned = false;
35474         int64_t ret_conv = Record_clone_ptr(&arg_conv);
35475         return ret_conv;
35476 }
35477
35478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35479         LDKRecord orig_conv;
35480         orig_conv.inner = untag_ptr(orig);
35481         orig_conv.is_owned = ptr_is_owned(orig);
35482         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35483         orig_conv.is_owned = false;
35484         LDKRecord ret_var = Record_clone(&orig_conv);
35485         int64_t ret_ref = 0;
35486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35488         return ret_ref;
35489 }
35490
35491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35492         if (!ptr_is_owned(this_ptr)) return;
35493         void* this_ptr_ptr = untag_ptr(this_ptr);
35494         CHECK_ACCESS(this_ptr_ptr);
35495         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
35496         FREE(untag_ptr(this_ptr));
35497         Logger_free(this_ptr_conv);
35498 }
35499
35500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35501         LDKChannelHandshakeConfig this_obj_conv;
35502         this_obj_conv.inner = untag_ptr(this_obj);
35503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35505         ChannelHandshakeConfig_free(this_obj_conv);
35506 }
35507
35508 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
35509         LDKChannelHandshakeConfig this_ptr_conv;
35510         this_ptr_conv.inner = untag_ptr(this_ptr);
35511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35513         this_ptr_conv.is_owned = false;
35514         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
35515         return ret_conv;
35516 }
35517
35518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35519         LDKChannelHandshakeConfig this_ptr_conv;
35520         this_ptr_conv.inner = untag_ptr(this_ptr);
35521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35523         this_ptr_conv.is_owned = false;
35524         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
35525 }
35526
35527 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35528         LDKChannelHandshakeConfig this_ptr_conv;
35529         this_ptr_conv.inner = untag_ptr(this_ptr);
35530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35532         this_ptr_conv.is_owned = false;
35533         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
35534         return ret_conv;
35535 }
35536
35537 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) {
35538         LDKChannelHandshakeConfig this_ptr_conv;
35539         this_ptr_conv.inner = untag_ptr(this_ptr);
35540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35542         this_ptr_conv.is_owned = false;
35543         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
35544 }
35545
35546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35547         LDKChannelHandshakeConfig this_ptr_conv;
35548         this_ptr_conv.inner = untag_ptr(this_ptr);
35549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35551         this_ptr_conv.is_owned = false;
35552         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
35553         return ret_conv;
35554 }
35555
35556 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) {
35557         LDKChannelHandshakeConfig this_ptr_conv;
35558         this_ptr_conv.inner = untag_ptr(this_ptr);
35559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35561         this_ptr_conv.is_owned = false;
35562         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
35563 }
35564
35565 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) {
35566         LDKChannelHandshakeConfig this_ptr_conv;
35567         this_ptr_conv.inner = untag_ptr(this_ptr);
35568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35570         this_ptr_conv.is_owned = false;
35571         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
35572         return ret_conv;
35573 }
35574
35575 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) {
35576         LDKChannelHandshakeConfig this_ptr_conv;
35577         this_ptr_conv.inner = untag_ptr(this_ptr);
35578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35580         this_ptr_conv.is_owned = false;
35581         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
35582 }
35583
35584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
35585         LDKChannelHandshakeConfig this_ptr_conv;
35586         this_ptr_conv.inner = untag_ptr(this_ptr);
35587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35589         this_ptr_conv.is_owned = false;
35590         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
35591         return ret_conv;
35592 }
35593
35594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35595         LDKChannelHandshakeConfig this_ptr_conv;
35596         this_ptr_conv.inner = untag_ptr(this_ptr);
35597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35599         this_ptr_conv.is_owned = false;
35600         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
35601 }
35602
35603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
35604         LDKChannelHandshakeConfig this_ptr_conv;
35605         this_ptr_conv.inner = untag_ptr(this_ptr);
35606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35608         this_ptr_conv.is_owned = false;
35609         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
35610         return ret_conv;
35611 }
35612
35613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35614         LDKChannelHandshakeConfig this_ptr_conv;
35615         this_ptr_conv.inner = untag_ptr(this_ptr);
35616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35618         this_ptr_conv.is_owned = false;
35619         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
35620 }
35621
35622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
35623         LDKChannelHandshakeConfig this_ptr_conv;
35624         this_ptr_conv.inner = untag_ptr(this_ptr);
35625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35627         this_ptr_conv.is_owned = false;
35628         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
35629         return ret_conv;
35630 }
35631
35632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35633         LDKChannelHandshakeConfig this_ptr_conv;
35634         this_ptr_conv.inner = untag_ptr(this_ptr);
35635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35637         this_ptr_conv.is_owned = false;
35638         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
35639 }
35640
35641 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
35642         LDKChannelHandshakeConfig this_ptr_conv;
35643         this_ptr_conv.inner = untag_ptr(this_ptr);
35644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35646         this_ptr_conv.is_owned = false;
35647         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
35648         return ret_conv;
35649 }
35650
35651 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) {
35652         LDKChannelHandshakeConfig this_ptr_conv;
35653         this_ptr_conv.inner = untag_ptr(this_ptr);
35654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35656         this_ptr_conv.is_owned = false;
35657         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
35658 }
35659
35660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
35661         LDKChannelHandshakeConfig this_ptr_conv;
35662         this_ptr_conv.inner = untag_ptr(this_ptr);
35663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35665         this_ptr_conv.is_owned = false;
35666         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
35667         return ret_conv;
35668 }
35669
35670 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) {
35671         LDKChannelHandshakeConfig this_ptr_conv;
35672         this_ptr_conv.inner = untag_ptr(this_ptr);
35673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35675         this_ptr_conv.is_owned = false;
35676         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
35677 }
35678
35679 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35680         LDKChannelHandshakeConfig this_ptr_conv;
35681         this_ptr_conv.inner = untag_ptr(this_ptr);
35682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35684         this_ptr_conv.is_owned = false;
35685         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
35686         return ret_conv;
35687 }
35688
35689 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) {
35690         LDKChannelHandshakeConfig this_ptr_conv;
35691         this_ptr_conv.inner = untag_ptr(this_ptr);
35692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35694         this_ptr_conv.is_owned = false;
35695         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
35696 }
35697
35698 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) {
35699         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);
35700         int64_t ret_ref = 0;
35701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35703         return ret_ref;
35704 }
35705
35706 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
35707         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
35708         int64_t ret_ref = 0;
35709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35711         return ret_ref;
35712 }
35713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35714         LDKChannelHandshakeConfig arg_conv;
35715         arg_conv.inner = untag_ptr(arg);
35716         arg_conv.is_owned = ptr_is_owned(arg);
35717         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35718         arg_conv.is_owned = false;
35719         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
35720         return ret_conv;
35721 }
35722
35723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35724         LDKChannelHandshakeConfig orig_conv;
35725         orig_conv.inner = untag_ptr(orig);
35726         orig_conv.is_owned = ptr_is_owned(orig);
35727         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35728         orig_conv.is_owned = false;
35729         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
35730         int64_t ret_ref = 0;
35731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35733         return ret_ref;
35734 }
35735
35736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
35737         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
35738         int64_t ret_ref = 0;
35739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35741         return ret_ref;
35742 }
35743
35744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35745         LDKChannelHandshakeLimits this_obj_conv;
35746         this_obj_conv.inner = untag_ptr(this_obj);
35747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35749         ChannelHandshakeLimits_free(this_obj_conv);
35750 }
35751
35752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35753         LDKChannelHandshakeLimits this_ptr_conv;
35754         this_ptr_conv.inner = untag_ptr(this_ptr);
35755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35757         this_ptr_conv.is_owned = false;
35758         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
35759         return ret_conv;
35760 }
35761
35762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35763         LDKChannelHandshakeLimits this_ptr_conv;
35764         this_ptr_conv.inner = untag_ptr(this_ptr);
35765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35767         this_ptr_conv.is_owned = false;
35768         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
35769 }
35770
35771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35772         LDKChannelHandshakeLimits this_ptr_conv;
35773         this_ptr_conv.inner = untag_ptr(this_ptr);
35774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35776         this_ptr_conv.is_owned = false;
35777         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
35778         return ret_conv;
35779 }
35780
35781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35782         LDKChannelHandshakeLimits this_ptr_conv;
35783         this_ptr_conv.inner = untag_ptr(this_ptr);
35784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35786         this_ptr_conv.is_owned = false;
35787         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
35788 }
35789
35790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35791         LDKChannelHandshakeLimits this_ptr_conv;
35792         this_ptr_conv.inner = untag_ptr(this_ptr);
35793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35795         this_ptr_conv.is_owned = false;
35796         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
35797         return ret_conv;
35798 }
35799
35800 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) {
35801         LDKChannelHandshakeLimits this_ptr_conv;
35802         this_ptr_conv.inner = untag_ptr(this_ptr);
35803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35805         this_ptr_conv.is_owned = false;
35806         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
35807 }
35808
35809 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) {
35810         LDKChannelHandshakeLimits this_ptr_conv;
35811         this_ptr_conv.inner = untag_ptr(this_ptr);
35812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35814         this_ptr_conv.is_owned = false;
35815         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
35816         return ret_conv;
35817 }
35818
35819 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) {
35820         LDKChannelHandshakeLimits this_ptr_conv;
35821         this_ptr_conv.inner = untag_ptr(this_ptr);
35822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35824         this_ptr_conv.is_owned = false;
35825         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35826 }
35827
35828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35829         LDKChannelHandshakeLimits this_ptr_conv;
35830         this_ptr_conv.inner = untag_ptr(this_ptr);
35831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35833         this_ptr_conv.is_owned = false;
35834         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
35835         return ret_conv;
35836 }
35837
35838 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) {
35839         LDKChannelHandshakeLimits this_ptr_conv;
35840         this_ptr_conv.inner = untag_ptr(this_ptr);
35841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35843         this_ptr_conv.is_owned = false;
35844         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
35845 }
35846
35847 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35848         LDKChannelHandshakeLimits this_ptr_conv;
35849         this_ptr_conv.inner = untag_ptr(this_ptr);
35850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35852         this_ptr_conv.is_owned = false;
35853         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
35854         return ret_conv;
35855 }
35856
35857 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) {
35858         LDKChannelHandshakeLimits this_ptr_conv;
35859         this_ptr_conv.inner = untag_ptr(this_ptr);
35860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35862         this_ptr_conv.is_owned = false;
35863         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
35864 }
35865
35866 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
35867         LDKChannelHandshakeLimits this_ptr_conv;
35868         this_ptr_conv.inner = untag_ptr(this_ptr);
35869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35871         this_ptr_conv.is_owned = false;
35872         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
35873         return ret_conv;
35874 }
35875
35876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35877         LDKChannelHandshakeLimits this_ptr_conv;
35878         this_ptr_conv.inner = untag_ptr(this_ptr);
35879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35881         this_ptr_conv.is_owned = false;
35882         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
35883 }
35884
35885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
35886         LDKChannelHandshakeLimits this_ptr_conv;
35887         this_ptr_conv.inner = untag_ptr(this_ptr);
35888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35890         this_ptr_conv.is_owned = false;
35891         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
35892         return ret_conv;
35893 }
35894
35895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35896         LDKChannelHandshakeLimits this_ptr_conv;
35897         this_ptr_conv.inner = untag_ptr(this_ptr);
35898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35900         this_ptr_conv.is_owned = false;
35901         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
35902 }
35903
35904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
35905         LDKChannelHandshakeLimits this_ptr_conv;
35906         this_ptr_conv.inner = untag_ptr(this_ptr);
35907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35909         this_ptr_conv.is_owned = false;
35910         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
35911         return ret_conv;
35912 }
35913
35914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35915         LDKChannelHandshakeLimits this_ptr_conv;
35916         this_ptr_conv.inner = untag_ptr(this_ptr);
35917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35919         this_ptr_conv.is_owned = false;
35920         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
35921 }
35922
35923 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35924         LDKChannelHandshakeLimits this_ptr_conv;
35925         this_ptr_conv.inner = untag_ptr(this_ptr);
35926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35928         this_ptr_conv.is_owned = false;
35929         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
35930         return ret_conv;
35931 }
35932
35933 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) {
35934         LDKChannelHandshakeLimits this_ptr_conv;
35935         this_ptr_conv.inner = untag_ptr(this_ptr);
35936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35938         this_ptr_conv.is_owned = false;
35939         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
35940 }
35941
35942 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) {
35943         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);
35944         int64_t ret_ref = 0;
35945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35947         return ret_ref;
35948 }
35949
35950 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
35951         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
35952         int64_t ret_ref = 0;
35953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35955         return ret_ref;
35956 }
35957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35958         LDKChannelHandshakeLimits arg_conv;
35959         arg_conv.inner = untag_ptr(arg);
35960         arg_conv.is_owned = ptr_is_owned(arg);
35961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35962         arg_conv.is_owned = false;
35963         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
35964         return ret_conv;
35965 }
35966
35967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35968         LDKChannelHandshakeLimits orig_conv;
35969         orig_conv.inner = untag_ptr(orig);
35970         orig_conv.is_owned = ptr_is_owned(orig);
35971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35972         orig_conv.is_owned = false;
35973         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
35974         int64_t ret_ref = 0;
35975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35977         return ret_ref;
35978 }
35979
35980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
35981         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
35982         int64_t ret_ref = 0;
35983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35985         return ret_ref;
35986 }
35987
35988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35989         if (!ptr_is_owned(this_ptr)) return;
35990         void* this_ptr_ptr = untag_ptr(this_ptr);
35991         CHECK_ACCESS(this_ptr_ptr);
35992         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
35993         FREE(untag_ptr(this_ptr));
35994         MaxDustHTLCExposure_free(this_ptr_conv);
35995 }
35996
35997 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
35998         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
35999         *ret_copy = MaxDustHTLCExposure_clone(arg);
36000         int64_t ret_ref = tag_ptr(ret_copy, true);
36001         return ret_ref;
36002 }
36003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36004         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
36005         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
36006         return ret_conv;
36007 }
36008
36009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36010         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
36011         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36012         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
36013         int64_t ret_ref = tag_ptr(ret_copy, true);
36014         return ret_ref;
36015 }
36016
36017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
36018         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36019         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
36020         int64_t ret_ref = tag_ptr(ret_copy, true);
36021         return ret_ref;
36022 }
36023
36024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
36025         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36026         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
36027         int64_t ret_ref = tag_ptr(ret_copy, true);
36028         return ret_ref;
36029 }
36030
36031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36032         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
36033         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
36034         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
36035         return ret_conv;
36036 }
36037
36038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
36039         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
36040         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
36041         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36042         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36043         CVec_u8Z_free(ret_var);
36044         return ret_arr;
36045 }
36046
36047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36048         LDKu8slice ser_ref;
36049         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36050         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36051         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
36052         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
36053         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36054         return tag_ptr(ret_conv, true);
36055 }
36056
36057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36058         LDKChannelConfig this_obj_conv;
36059         this_obj_conv.inner = untag_ptr(this_obj);
36060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36062         ChannelConfig_free(this_obj_conv);
36063 }
36064
36065 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36066         LDKChannelConfig this_ptr_conv;
36067         this_ptr_conv.inner = untag_ptr(this_ptr);
36068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36070         this_ptr_conv.is_owned = false;
36071         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36072         return ret_conv;
36073 }
36074
36075 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) {
36076         LDKChannelConfig this_ptr_conv;
36077         this_ptr_conv.inner = untag_ptr(this_ptr);
36078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36080         this_ptr_conv.is_owned = false;
36081         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
36082 }
36083
36084 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36085         LDKChannelConfig this_ptr_conv;
36086         this_ptr_conv.inner = untag_ptr(this_ptr);
36087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36089         this_ptr_conv.is_owned = false;
36090         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
36091         return ret_conv;
36092 }
36093
36094 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) {
36095         LDKChannelConfig this_ptr_conv;
36096         this_ptr_conv.inner = untag_ptr(this_ptr);
36097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36099         this_ptr_conv.is_owned = false;
36100         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
36101 }
36102
36103 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36104         LDKChannelConfig this_ptr_conv;
36105         this_ptr_conv.inner = untag_ptr(this_ptr);
36106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36108         this_ptr_conv.is_owned = false;
36109         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
36110         return ret_conv;
36111 }
36112
36113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36114         LDKChannelConfig this_ptr_conv;
36115         this_ptr_conv.inner = untag_ptr(this_ptr);
36116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36118         this_ptr_conv.is_owned = false;
36119         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
36120 }
36121
36122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
36123         LDKChannelConfig this_ptr_conv;
36124         this_ptr_conv.inner = untag_ptr(this_ptr);
36125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36127         this_ptr_conv.is_owned = false;
36128         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36129         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
36130         int64_t ret_ref = tag_ptr(ret_copy, true);
36131         return ret_ref;
36132 }
36133
36134 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) {
36135         LDKChannelConfig this_ptr_conv;
36136         this_ptr_conv.inner = untag_ptr(this_ptr);
36137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36139         this_ptr_conv.is_owned = false;
36140         void* val_ptr = untag_ptr(val);
36141         CHECK_ACCESS(val_ptr);
36142         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
36143         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
36144         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
36145 }
36146
36147 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) {
36148         LDKChannelConfig this_ptr_conv;
36149         this_ptr_conv.inner = untag_ptr(this_ptr);
36150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36152         this_ptr_conv.is_owned = false;
36153         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36154         return ret_conv;
36155 }
36156
36157 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) {
36158         LDKChannelConfig this_ptr_conv;
36159         this_ptr_conv.inner = untag_ptr(this_ptr);
36160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36162         this_ptr_conv.is_owned = false;
36163         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
36164 }
36165
36166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36167         LDKChannelConfig this_ptr_conv;
36168         this_ptr_conv.inner = untag_ptr(this_ptr);
36169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36171         this_ptr_conv.is_owned = false;
36172         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
36173         return ret_conv;
36174 }
36175
36176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36177         LDKChannelConfig this_ptr_conv;
36178         this_ptr_conv.inner = untag_ptr(this_ptr);
36179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36181         this_ptr_conv.is_owned = false;
36182         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
36183 }
36184
36185 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) {
36186         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
36187         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
36188         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
36189         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
36190         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);
36191         int64_t ret_ref = 0;
36192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36194         return ret_ref;
36195 }
36196
36197 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
36198         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
36199         int64_t ret_ref = 0;
36200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36202         return ret_ref;
36203 }
36204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36205         LDKChannelConfig arg_conv;
36206         arg_conv.inner = untag_ptr(arg);
36207         arg_conv.is_owned = ptr_is_owned(arg);
36208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36209         arg_conv.is_owned = false;
36210         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
36211         return ret_conv;
36212 }
36213
36214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36215         LDKChannelConfig orig_conv;
36216         orig_conv.inner = untag_ptr(orig);
36217         orig_conv.is_owned = ptr_is_owned(orig);
36218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36219         orig_conv.is_owned = false;
36220         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
36221         int64_t ret_ref = 0;
36222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36224         return ret_ref;
36225 }
36226
36227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36228         LDKChannelConfig a_conv;
36229         a_conv.inner = untag_ptr(a);
36230         a_conv.is_owned = ptr_is_owned(a);
36231         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36232         a_conv.is_owned = false;
36233         LDKChannelConfig b_conv;
36234         b_conv.inner = untag_ptr(b);
36235         b_conv.is_owned = ptr_is_owned(b);
36236         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36237         b_conv.is_owned = false;
36238         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
36239         return ret_conv;
36240 }
36241
36242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
36243         LDKChannelConfig this_arg_conv;
36244         this_arg_conv.inner = untag_ptr(this_arg);
36245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36247         this_arg_conv.is_owned = false;
36248         LDKChannelConfigUpdate update_conv;
36249         update_conv.inner = untag_ptr(update);
36250         update_conv.is_owned = ptr_is_owned(update);
36251         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
36252         update_conv.is_owned = false;
36253         ChannelConfig_apply(&this_arg_conv, &update_conv);
36254 }
36255
36256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
36257         LDKChannelConfig ret_var = ChannelConfig_default();
36258         int64_t ret_ref = 0;
36259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36261         return ret_ref;
36262 }
36263
36264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
36265         LDKChannelConfig obj_conv;
36266         obj_conv.inner = untag_ptr(obj);
36267         obj_conv.is_owned = ptr_is_owned(obj);
36268         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36269         obj_conv.is_owned = false;
36270         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
36271         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36272         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36273         CVec_u8Z_free(ret_var);
36274         return ret_arr;
36275 }
36276
36277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36278         LDKu8slice ser_ref;
36279         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36280         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36281         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
36282         *ret_conv = ChannelConfig_read(ser_ref);
36283         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36284         return tag_ptr(ret_conv, true);
36285 }
36286
36287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36288         LDKChannelConfigUpdate this_obj_conv;
36289         this_obj_conv.inner = untag_ptr(this_obj);
36290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36292         ChannelConfigUpdate_free(this_obj_conv);
36293 }
36294
36295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36296         LDKChannelConfigUpdate this_ptr_conv;
36297         this_ptr_conv.inner = untag_ptr(this_ptr);
36298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36300         this_ptr_conv.is_owned = false;
36301         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36302         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36303         int64_t ret_ref = tag_ptr(ret_copy, true);
36304         return ret_ref;
36305 }
36306
36307 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) {
36308         LDKChannelConfigUpdate this_ptr_conv;
36309         this_ptr_conv.inner = untag_ptr(this_ptr);
36310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36312         this_ptr_conv.is_owned = false;
36313         void* val_ptr = untag_ptr(val);
36314         CHECK_ACCESS(val_ptr);
36315         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36316         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36317         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
36318 }
36319
36320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36321         LDKChannelConfigUpdate this_ptr_conv;
36322         this_ptr_conv.inner = untag_ptr(this_ptr);
36323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36325         this_ptr_conv.is_owned = false;
36326         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36327         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
36328         int64_t ret_ref = tag_ptr(ret_copy, true);
36329         return ret_ref;
36330 }
36331
36332 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) {
36333         LDKChannelConfigUpdate this_ptr_conv;
36334         this_ptr_conv.inner = untag_ptr(this_ptr);
36335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36337         this_ptr_conv.is_owned = false;
36338         void* val_ptr = untag_ptr(val);
36339         CHECK_ACCESS(val_ptr);
36340         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36341         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36342         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
36343 }
36344
36345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36346         LDKChannelConfigUpdate this_ptr_conv;
36347         this_ptr_conv.inner = untag_ptr(this_ptr);
36348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36350         this_ptr_conv.is_owned = false;
36351         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
36352         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
36353         int64_t ret_ref = tag_ptr(ret_copy, true);
36354         return ret_ref;
36355 }
36356
36357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36358         LDKChannelConfigUpdate this_ptr_conv;
36359         this_ptr_conv.inner = untag_ptr(this_ptr);
36360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36362         this_ptr_conv.is_owned = false;
36363         void* val_ptr = untag_ptr(val);
36364         CHECK_ACCESS(val_ptr);
36365         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
36366         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
36367         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
36368 }
36369
36370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36371         LDKChannelConfigUpdate this_ptr_conv;
36372         this_ptr_conv.inner = untag_ptr(this_ptr);
36373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36375         this_ptr_conv.is_owned = false;
36376         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
36377         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
36378         int64_t ret_ref = tag_ptr(ret_copy, true);
36379         return ret_ref;
36380 }
36381
36382 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) {
36383         LDKChannelConfigUpdate this_ptr_conv;
36384         this_ptr_conv.inner = untag_ptr(this_ptr);
36385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36387         this_ptr_conv.is_owned = false;
36388         void* val_ptr = untag_ptr(val);
36389         CHECK_ACCESS(val_ptr);
36390         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
36391         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
36392         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
36393 }
36394
36395 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) {
36396         LDKChannelConfigUpdate this_ptr_conv;
36397         this_ptr_conv.inner = untag_ptr(this_ptr);
36398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36400         this_ptr_conv.is_owned = false;
36401         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36402         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36403         int64_t ret_ref = tag_ptr(ret_copy, true);
36404         return ret_ref;
36405 }
36406
36407 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) {
36408         LDKChannelConfigUpdate this_ptr_conv;
36409         this_ptr_conv.inner = untag_ptr(this_ptr);
36410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36412         this_ptr_conv.is_owned = false;
36413         void* val_ptr = untag_ptr(val);
36414         CHECK_ACCESS(val_ptr);
36415         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36416         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36417         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
36418 }
36419
36420 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) {
36421         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
36422         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
36423         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
36424         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
36425         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
36426         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
36427         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
36428         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
36429         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
36430         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
36431         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
36432         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
36433         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
36434         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
36435         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
36436         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
36437         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
36438         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
36439         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
36440         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
36441         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);
36442         int64_t ret_ref = 0;
36443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36445         return ret_ref;
36446 }
36447
36448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
36449         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
36450         int64_t ret_ref = 0;
36451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36453         return ret_ref;
36454 }
36455
36456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36457         LDKUserConfig this_obj_conv;
36458         this_obj_conv.inner = untag_ptr(this_obj);
36459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36461         UserConfig_free(this_obj_conv);
36462 }
36463
36464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
36465         LDKUserConfig this_ptr_conv;
36466         this_ptr_conv.inner = untag_ptr(this_ptr);
36467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36469         this_ptr_conv.is_owned = false;
36470         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
36471         int64_t ret_ref = 0;
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36474         return ret_ref;
36475 }
36476
36477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36478         LDKUserConfig this_ptr_conv;
36479         this_ptr_conv.inner = untag_ptr(this_ptr);
36480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36482         this_ptr_conv.is_owned = false;
36483         LDKChannelHandshakeConfig val_conv;
36484         val_conv.inner = untag_ptr(val);
36485         val_conv.is_owned = ptr_is_owned(val);
36486         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36487         val_conv = ChannelHandshakeConfig_clone(&val_conv);
36488         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
36489 }
36490
36491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
36492         LDKUserConfig this_ptr_conv;
36493         this_ptr_conv.inner = untag_ptr(this_ptr);
36494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36496         this_ptr_conv.is_owned = false;
36497         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
36498         int64_t ret_ref = 0;
36499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36501         return ret_ref;
36502 }
36503
36504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36505         LDKUserConfig this_ptr_conv;
36506         this_ptr_conv.inner = untag_ptr(this_ptr);
36507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36509         this_ptr_conv.is_owned = false;
36510         LDKChannelHandshakeLimits val_conv;
36511         val_conv.inner = untag_ptr(val);
36512         val_conv.is_owned = ptr_is_owned(val);
36513         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36514         val_conv = ChannelHandshakeLimits_clone(&val_conv);
36515         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
36516 }
36517
36518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
36519         LDKUserConfig this_ptr_conv;
36520         this_ptr_conv.inner = untag_ptr(this_ptr);
36521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36523         this_ptr_conv.is_owned = false;
36524         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
36525         int64_t ret_ref = 0;
36526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36528         return ret_ref;
36529 }
36530
36531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36532         LDKUserConfig this_ptr_conv;
36533         this_ptr_conv.inner = untag_ptr(this_ptr);
36534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36536         this_ptr_conv.is_owned = false;
36537         LDKChannelConfig val_conv;
36538         val_conv.inner = untag_ptr(val);
36539         val_conv.is_owned = ptr_is_owned(val);
36540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36541         val_conv = ChannelConfig_clone(&val_conv);
36542         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
36543 }
36544
36545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
36546         LDKUserConfig this_ptr_conv;
36547         this_ptr_conv.inner = untag_ptr(this_ptr);
36548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36550         this_ptr_conv.is_owned = false;
36551         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
36552         return ret_conv;
36553 }
36554
36555 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) {
36556         LDKUserConfig this_ptr_conv;
36557         this_ptr_conv.inner = untag_ptr(this_ptr);
36558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36560         this_ptr_conv.is_owned = false;
36561         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
36562 }
36563
36564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
36565         LDKUserConfig this_ptr_conv;
36566         this_ptr_conv.inner = untag_ptr(this_ptr);
36567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36569         this_ptr_conv.is_owned = false;
36570         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
36571         return ret_conv;
36572 }
36573
36574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36575         LDKUserConfig this_ptr_conv;
36576         this_ptr_conv.inner = untag_ptr(this_ptr);
36577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36579         this_ptr_conv.is_owned = false;
36580         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
36581 }
36582
36583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
36584         LDKUserConfig this_ptr_conv;
36585         this_ptr_conv.inner = untag_ptr(this_ptr);
36586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36588         this_ptr_conv.is_owned = false;
36589         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
36590         return ret_conv;
36591 }
36592
36593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36594         LDKUserConfig this_ptr_conv;
36595         this_ptr_conv.inner = untag_ptr(this_ptr);
36596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36598         this_ptr_conv.is_owned = false;
36599         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
36600 }
36601
36602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36603         LDKUserConfig this_ptr_conv;
36604         this_ptr_conv.inner = untag_ptr(this_ptr);
36605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36607         this_ptr_conv.is_owned = false;
36608         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
36609         return ret_conv;
36610 }
36611
36612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36613         LDKUserConfig this_ptr_conv;
36614         this_ptr_conv.inner = untag_ptr(this_ptr);
36615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36617         this_ptr_conv.is_owned = false;
36618         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
36619 }
36620
36621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
36622         LDKUserConfig this_ptr_conv;
36623         this_ptr_conv.inner = untag_ptr(this_ptr);
36624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36626         this_ptr_conv.is_owned = false;
36627         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
36628         return ret_conv;
36629 }
36630
36631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36632         LDKUserConfig this_ptr_conv;
36633         this_ptr_conv.inner = untag_ptr(this_ptr);
36634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36636         this_ptr_conv.is_owned = false;
36637         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
36638 }
36639
36640 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) {
36641         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
36642         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
36643         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
36644         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
36645         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
36646         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
36647         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
36648         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
36649         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
36650         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
36651         LDKChannelConfig channel_config_arg_conv;
36652         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
36653         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
36654         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
36655         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
36656         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);
36657         int64_t ret_ref = 0;
36658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36660         return ret_ref;
36661 }
36662
36663 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
36664         LDKUserConfig ret_var = UserConfig_clone(arg);
36665         int64_t ret_ref = 0;
36666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36668         return ret_ref;
36669 }
36670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36671         LDKUserConfig arg_conv;
36672         arg_conv.inner = untag_ptr(arg);
36673         arg_conv.is_owned = ptr_is_owned(arg);
36674         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36675         arg_conv.is_owned = false;
36676         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
36677         return ret_conv;
36678 }
36679
36680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36681         LDKUserConfig orig_conv;
36682         orig_conv.inner = untag_ptr(orig);
36683         orig_conv.is_owned = ptr_is_owned(orig);
36684         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36685         orig_conv.is_owned = false;
36686         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
36687         int64_t ret_ref = 0;
36688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36690         return ret_ref;
36691 }
36692
36693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
36694         LDKUserConfig ret_var = UserConfig_default();
36695         int64_t ret_ref = 0;
36696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36698         return ret_ref;
36699 }
36700
36701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36702         LDKBestBlock this_obj_conv;
36703         this_obj_conv.inner = untag_ptr(this_obj);
36704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36706         BestBlock_free(this_obj_conv);
36707 }
36708
36709 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
36710         LDKBestBlock ret_var = BestBlock_clone(arg);
36711         int64_t ret_ref = 0;
36712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36714         return ret_ref;
36715 }
36716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36717         LDKBestBlock arg_conv;
36718         arg_conv.inner = untag_ptr(arg);
36719         arg_conv.is_owned = ptr_is_owned(arg);
36720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36721         arg_conv.is_owned = false;
36722         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
36723         return ret_conv;
36724 }
36725
36726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36727         LDKBestBlock orig_conv;
36728         orig_conv.inner = untag_ptr(orig);
36729         orig_conv.is_owned = ptr_is_owned(orig);
36730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36731         orig_conv.is_owned = false;
36732         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
36733         int64_t ret_ref = 0;
36734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36736         return ret_ref;
36737 }
36738
36739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36740         LDKBestBlock a_conv;
36741         a_conv.inner = untag_ptr(a);
36742         a_conv.is_owned = ptr_is_owned(a);
36743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36744         a_conv.is_owned = false;
36745         LDKBestBlock b_conv;
36746         b_conv.inner = untag_ptr(b);
36747         b_conv.is_owned = ptr_is_owned(b);
36748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36749         b_conv.is_owned = false;
36750         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
36751         return ret_conv;
36752 }
36753
36754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
36755         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
36756         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
36757         int64_t ret_ref = 0;
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36760         return ret_ref;
36761 }
36762
36763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
36764         LDKThirtyTwoBytes block_hash_ref;
36765         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
36766         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
36767         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
36768         int64_t ret_ref = 0;
36769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36771         return ret_ref;
36772 }
36773
36774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
36775         LDKBestBlock this_arg_conv;
36776         this_arg_conv.inner = untag_ptr(this_arg);
36777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36779         this_arg_conv.is_owned = false;
36780         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36781         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
36782         return ret_arr;
36783 }
36784
36785 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
36786         LDKBestBlock this_arg_conv;
36787         this_arg_conv.inner = untag_ptr(this_arg);
36788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36790         this_arg_conv.is_owned = false;
36791         int32_t ret_conv = BestBlock_height(&this_arg_conv);
36792         return ret_conv;
36793 }
36794
36795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36796         if (!ptr_is_owned(this_ptr)) return;
36797         void* this_ptr_ptr = untag_ptr(this_ptr);
36798         CHECK_ACCESS(this_ptr_ptr);
36799         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
36800         FREE(untag_ptr(this_ptr));
36801         Listen_free(this_ptr_conv);
36802 }
36803
36804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36805         if (!ptr_is_owned(this_ptr)) return;
36806         void* this_ptr_ptr = untag_ptr(this_ptr);
36807         CHECK_ACCESS(this_ptr_ptr);
36808         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
36809         FREE(untag_ptr(this_ptr));
36810         Confirm_free(this_ptr_conv);
36811 }
36812
36813 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36814         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
36815         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
36816         return ret_conv;
36817 }
36818
36819 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
36820         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
36821         return ret_conv;
36822 }
36823
36824 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
36825         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
36826         return ret_conv;
36827 }
36828
36829 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
36830         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
36831         return ret_conv;
36832 }
36833
36834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36835         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
36836         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
36837         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
36838         return ret_conv;
36839 }
36840
36841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36842         if (!ptr_is_owned(this_ptr)) return;
36843         void* this_ptr_ptr = untag_ptr(this_ptr);
36844         CHECK_ACCESS(this_ptr_ptr);
36845         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
36846         FREE(untag_ptr(this_ptr));
36847         Watch_free(this_ptr_conv);
36848 }
36849
36850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36851         if (!ptr_is_owned(this_ptr)) return;
36852         void* this_ptr_ptr = untag_ptr(this_ptr);
36853         CHECK_ACCESS(this_ptr_ptr);
36854         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
36855         FREE(untag_ptr(this_ptr));
36856         Filter_free(this_ptr_conv);
36857 }
36858
36859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36860         LDKWatchedOutput this_obj_conv;
36861         this_obj_conv.inner = untag_ptr(this_obj);
36862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36864         WatchedOutput_free(this_obj_conv);
36865 }
36866
36867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36868         LDKWatchedOutput this_ptr_conv;
36869         this_ptr_conv.inner = untag_ptr(this_ptr);
36870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36872         this_ptr_conv.is_owned = false;
36873         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
36874         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
36875         int64_t ret_ref = tag_ptr(ret_copy, true);
36876         return ret_ref;
36877 }
36878
36879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36880         LDKWatchedOutput this_ptr_conv;
36881         this_ptr_conv.inner = untag_ptr(this_ptr);
36882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36884         this_ptr_conv.is_owned = false;
36885         void* val_ptr = untag_ptr(val);
36886         CHECK_ACCESS(val_ptr);
36887         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
36888         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
36889         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
36890 }
36891
36892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36893         LDKWatchedOutput this_ptr_conv;
36894         this_ptr_conv.inner = untag_ptr(this_ptr);
36895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36897         this_ptr_conv.is_owned = false;
36898         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
36899         int64_t ret_ref = 0;
36900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36902         return ret_ref;
36903 }
36904
36905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36906         LDKWatchedOutput this_ptr_conv;
36907         this_ptr_conv.inner = untag_ptr(this_ptr);
36908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36910         this_ptr_conv.is_owned = false;
36911         LDKOutPoint val_conv;
36912         val_conv.inner = untag_ptr(val);
36913         val_conv.is_owned = ptr_is_owned(val);
36914         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36915         val_conv = OutPoint_clone(&val_conv);
36916         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
36917 }
36918
36919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36920         LDKWatchedOutput this_ptr_conv;
36921         this_ptr_conv.inner = untag_ptr(this_ptr);
36922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36924         this_ptr_conv.is_owned = false;
36925         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
36926         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36927         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36928         return ret_arr;
36929 }
36930
36931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36932         LDKWatchedOutput this_ptr_conv;
36933         this_ptr_conv.inner = untag_ptr(this_ptr);
36934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36936         this_ptr_conv.is_owned = false;
36937         LDKCVec_u8Z val_ref;
36938         val_ref.datalen = (*env)->GetArrayLength(env, val);
36939         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36940         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36941         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
36942 }
36943
36944 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) {
36945         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
36946         CHECK_ACCESS(block_hash_arg_ptr);
36947         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
36948         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
36949         LDKOutPoint outpoint_arg_conv;
36950         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
36951         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
36952         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
36953         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
36954         LDKCVec_u8Z script_pubkey_arg_ref;
36955         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
36956         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36957         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
36958         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
36959         int64_t ret_ref = 0;
36960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36962         return ret_ref;
36963 }
36964
36965 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
36966         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
36967         int64_t ret_ref = 0;
36968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36970         return ret_ref;
36971 }
36972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36973         LDKWatchedOutput arg_conv;
36974         arg_conv.inner = untag_ptr(arg);
36975         arg_conv.is_owned = ptr_is_owned(arg);
36976         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36977         arg_conv.is_owned = false;
36978         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
36979         return ret_conv;
36980 }
36981
36982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36983         LDKWatchedOutput orig_conv;
36984         orig_conv.inner = untag_ptr(orig);
36985         orig_conv.is_owned = ptr_is_owned(orig);
36986         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36987         orig_conv.is_owned = false;
36988         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
36989         int64_t ret_ref = 0;
36990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36992         return ret_ref;
36993 }
36994
36995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36996         LDKWatchedOutput a_conv;
36997         a_conv.inner = untag_ptr(a);
36998         a_conv.is_owned = ptr_is_owned(a);
36999         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37000         a_conv.is_owned = false;
37001         LDKWatchedOutput b_conv;
37002         b_conv.inner = untag_ptr(b);
37003         b_conv.is_owned = ptr_is_owned(b);
37004         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37005         b_conv.is_owned = false;
37006         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
37007         return ret_conv;
37008 }
37009
37010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
37011         LDKWatchedOutput o_conv;
37012         o_conv.inner = untag_ptr(o);
37013         o_conv.is_owned = ptr_is_owned(o);
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37015         o_conv.is_owned = false;
37016         int64_t ret_conv = WatchedOutput_hash(&o_conv);
37017         return ret_conv;
37018 }
37019
37020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37021         if (!ptr_is_owned(this_ptr)) return;
37022         void* this_ptr_ptr = untag_ptr(this_ptr);
37023         CHECK_ACCESS(this_ptr_ptr);
37024         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
37025         FREE(untag_ptr(this_ptr));
37026         BroadcasterInterface_free(this_ptr_conv);
37027 }
37028
37029 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37030         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
37031         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
37032         return ret_conv;
37033 }
37034
37035 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1mempool_1minimum(JNIEnv *env, jclass clz) {
37036         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_mempool_minimum());
37037         return ret_conv;
37038 }
37039
37040 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
37041         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
37042         return ret_conv;
37043 }
37044
37045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
37046         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
37047         return ret_conv;
37048 }
37049
37050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
37051         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
37052         return ret_conv;
37053 }
37054
37055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
37056         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
37057         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
37058         return ret_conv;
37059 }
37060
37061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37062         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
37063         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
37064         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
37065         return ret_conv;
37066 }
37067
37068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37069         if (!ptr_is_owned(this_ptr)) return;
37070         void* this_ptr_ptr = untag_ptr(this_ptr);
37071         CHECK_ACCESS(this_ptr_ptr);
37072         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
37073         FREE(untag_ptr(this_ptr));
37074         FeeEstimator_free(this_ptr_conv);
37075 }
37076
37077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37078         LDKMonitorUpdateId this_obj_conv;
37079         this_obj_conv.inner = untag_ptr(this_obj);
37080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37082         MonitorUpdateId_free(this_obj_conv);
37083 }
37084
37085 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
37086         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
37087         int64_t ret_ref = 0;
37088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37090         return ret_ref;
37091 }
37092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37093         LDKMonitorUpdateId arg_conv;
37094         arg_conv.inner = untag_ptr(arg);
37095         arg_conv.is_owned = ptr_is_owned(arg);
37096         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37097         arg_conv.is_owned = false;
37098         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
37099         return ret_conv;
37100 }
37101
37102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37103         LDKMonitorUpdateId orig_conv;
37104         orig_conv.inner = untag_ptr(orig);
37105         orig_conv.is_owned = ptr_is_owned(orig);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37107         orig_conv.is_owned = false;
37108         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
37109         int64_t ret_ref = 0;
37110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37112         return ret_ref;
37113 }
37114
37115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
37116         LDKMonitorUpdateId o_conv;
37117         o_conv.inner = untag_ptr(o);
37118         o_conv.is_owned = ptr_is_owned(o);
37119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37120         o_conv.is_owned = false;
37121         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
37122         return ret_conv;
37123 }
37124
37125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37126         LDKMonitorUpdateId a_conv;
37127         a_conv.inner = untag_ptr(a);
37128         a_conv.is_owned = ptr_is_owned(a);
37129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37130         a_conv.is_owned = false;
37131         LDKMonitorUpdateId b_conv;
37132         b_conv.inner = untag_ptr(b);
37133         b_conv.is_owned = ptr_is_owned(b);
37134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37135         b_conv.is_owned = false;
37136         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
37137         return ret_conv;
37138 }
37139
37140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37141         if (!ptr_is_owned(this_ptr)) return;
37142         void* this_ptr_ptr = untag_ptr(this_ptr);
37143         CHECK_ACCESS(this_ptr_ptr);
37144         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
37145         FREE(untag_ptr(this_ptr));
37146         Persist_free(this_ptr_conv);
37147 }
37148
37149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37150         LDKLockedChannelMonitor this_obj_conv;
37151         this_obj_conv.inner = untag_ptr(this_obj);
37152         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37154         LockedChannelMonitor_free(this_obj_conv);
37155 }
37156
37157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37158         LDKChainMonitor this_obj_conv;
37159         this_obj_conv.inner = untag_ptr(this_obj);
37160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37162         ChainMonitor_free(this_obj_conv);
37163 }
37164
37165 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) {
37166         void* chain_source_ptr = untag_ptr(chain_source);
37167         CHECK_ACCESS(chain_source_ptr);
37168         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
37169         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
37170         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
37171                 // Manually implement clone for Java trait instances
37172                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
37173                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37174                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
37175                 }
37176         }
37177         void* broadcaster_ptr = untag_ptr(broadcaster);
37178         CHECK_ACCESS(broadcaster_ptr);
37179         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
37180         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37181                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37182                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
37183         }
37184         void* logger_ptr = untag_ptr(logger);
37185         CHECK_ACCESS(logger_ptr);
37186         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37187         if (logger_conv.free == LDKLogger_JCalls_free) {
37188                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37189                 LDKLogger_JCalls_cloned(&logger_conv);
37190         }
37191         void* feeest_ptr = untag_ptr(feeest);
37192         CHECK_ACCESS(feeest_ptr);
37193         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
37194         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
37195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37196                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
37197         }
37198         void* persister_ptr = untag_ptr(persister);
37199         CHECK_ACCESS(persister_ptr);
37200         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
37201         if (persister_conv.free == LDKPersist_JCalls_free) {
37202                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37203                 LDKPersist_JCalls_cloned(&persister_conv);
37204         }
37205         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
37206         int64_t ret_ref = 0;
37207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37209         return ret_ref;
37210 }
37211
37212 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) {
37213         LDKChainMonitor this_arg_conv;
37214         this_arg_conv.inner = untag_ptr(this_arg);
37215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37217         this_arg_conv.is_owned = false;
37218         LDKCVec_ChannelDetailsZ ignored_channels_constr;
37219         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
37220         if (ignored_channels_constr.datalen > 0)
37221                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37222         else
37223                 ignored_channels_constr.data = NULL;
37224         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
37225         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
37226                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
37227                 LDKChannelDetails ignored_channels_conv_16_conv;
37228                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
37229                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
37230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
37231                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
37232                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
37233         }
37234         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
37235         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
37236         int64_tArray ret_arr = NULL;
37237         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37238         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37239         for (size_t j = 0; j < ret_var.datalen; j++) {
37240                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37241                 *ret_conv_9_copy = ret_var.data[j];
37242                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
37243                 ret_arr_ptr[j] = ret_conv_9_ref;
37244         }
37245         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37246         FREE(ret_var.data);
37247         return ret_arr;
37248 }
37249
37250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
37251         LDKChainMonitor this_arg_conv;
37252         this_arg_conv.inner = untag_ptr(this_arg);
37253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37255         this_arg_conv.is_owned = false;
37256         LDKOutPoint funding_txo_conv;
37257         funding_txo_conv.inner = untag_ptr(funding_txo);
37258         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37259         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37260         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37261         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37262         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
37263         return tag_ptr(ret_conv, true);
37264 }
37265
37266 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
37267         LDKChainMonitor this_arg_conv;
37268         this_arg_conv.inner = untag_ptr(this_arg);
37269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37271         this_arg_conv.is_owned = false;
37272         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
37273         int64_tArray ret_arr = NULL;
37274         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37275         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37276         for (size_t k = 0; k < ret_var.datalen; k++) {
37277                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
37278                 int64_t ret_conv_10_ref = 0;
37279                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
37280                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
37281                 ret_arr_ptr[k] = ret_conv_10_ref;
37282         }
37283         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37284         FREE(ret_var.data);
37285         return ret_arr;
37286 }
37287
37288 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
37289         LDKChainMonitor this_arg_conv;
37290         this_arg_conv.inner = untag_ptr(this_arg);
37291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37293         this_arg_conv.is_owned = false;
37294         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
37295         int64_tArray ret_arr = NULL;
37296         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37297         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37298         for (size_t p = 0; p < ret_var.datalen; p++) {
37299                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37300                 *ret_conv_41_conv = ret_var.data[p];
37301                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
37302         }
37303         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37304         FREE(ret_var.data);
37305         return ret_arr;
37306 }
37307
37308 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) {
37309         LDKChainMonitor this_arg_conv;
37310         this_arg_conv.inner = untag_ptr(this_arg);
37311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37313         this_arg_conv.is_owned = false;
37314         LDKOutPoint funding_txo_conv;
37315         funding_txo_conv.inner = untag_ptr(funding_txo);
37316         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37317         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37318         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37319         LDKMonitorUpdateId completed_update_id_conv;
37320         completed_update_id_conv.inner = untag_ptr(completed_update_id);
37321         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
37322         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
37323         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
37324         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
37325         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
37326         return tag_ptr(ret_conv, true);
37327 }
37328
37329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
37330         LDKChainMonitor this_arg_conv;
37331         this_arg_conv.inner = untag_ptr(this_arg);
37332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37334         this_arg_conv.is_owned = false;
37335         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
37336         int64_t ret_ref = 0;
37337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37339         return ret_ref;
37340 }
37341
37342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
37343         LDKChainMonitor this_arg_conv;
37344         this_arg_conv.inner = untag_ptr(this_arg);
37345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37347         this_arg_conv.is_owned = false;
37348         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
37349 }
37350
37351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
37352         LDKChainMonitor this_arg_conv;
37353         this_arg_conv.inner = untag_ptr(this_arg);
37354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37356         this_arg_conv.is_owned = false;
37357         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
37358         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
37359         return tag_ptr(ret_ret, true);
37360 }
37361
37362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
37363         LDKChainMonitor this_arg_conv;
37364         this_arg_conv.inner = untag_ptr(this_arg);
37365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37367         this_arg_conv.is_owned = false;
37368         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
37369         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
37370         return tag_ptr(ret_ret, true);
37371 }
37372
37373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
37374         LDKChainMonitor this_arg_conv;
37375         this_arg_conv.inner = untag_ptr(this_arg);
37376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37378         this_arg_conv.is_owned = false;
37379         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
37380         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
37381         return tag_ptr(ret_ret, true);
37382 }
37383
37384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37385         LDKChainMonitor this_arg_conv;
37386         this_arg_conv.inner = untag_ptr(this_arg);
37387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37389         this_arg_conv.is_owned = false;
37390         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
37391         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
37392         return tag_ptr(ret_ret, true);
37393 }
37394
37395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37396         LDKChannelMonitorUpdate this_obj_conv;
37397         this_obj_conv.inner = untag_ptr(this_obj);
37398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37400         ChannelMonitorUpdate_free(this_obj_conv);
37401 }
37402
37403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37404         LDKChannelMonitorUpdate this_ptr_conv;
37405         this_ptr_conv.inner = untag_ptr(this_ptr);
37406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37408         this_ptr_conv.is_owned = false;
37409         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
37410         return ret_conv;
37411 }
37412
37413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37414         LDKChannelMonitorUpdate this_ptr_conv;
37415         this_ptr_conv.inner = untag_ptr(this_ptr);
37416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37418         this_ptr_conv.is_owned = false;
37419         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
37420 }
37421
37422 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
37423         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
37424         int64_t ret_ref = 0;
37425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37427         return ret_ref;
37428 }
37429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37430         LDKChannelMonitorUpdate arg_conv;
37431         arg_conv.inner = untag_ptr(arg);
37432         arg_conv.is_owned = ptr_is_owned(arg);
37433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37434         arg_conv.is_owned = false;
37435         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
37436         return ret_conv;
37437 }
37438
37439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37440         LDKChannelMonitorUpdate orig_conv;
37441         orig_conv.inner = untag_ptr(orig);
37442         orig_conv.is_owned = ptr_is_owned(orig);
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37444         orig_conv.is_owned = false;
37445         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
37446         int64_t ret_ref = 0;
37447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37449         return ret_ref;
37450 }
37451
37452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37453         LDKChannelMonitorUpdate a_conv;
37454         a_conv.inner = untag_ptr(a);
37455         a_conv.is_owned = ptr_is_owned(a);
37456         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37457         a_conv.is_owned = false;
37458         LDKChannelMonitorUpdate b_conv;
37459         b_conv.inner = untag_ptr(b);
37460         b_conv.is_owned = ptr_is_owned(b);
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37462         b_conv.is_owned = false;
37463         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
37464         return ret_conv;
37465 }
37466
37467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37468         LDKChannelMonitorUpdate obj_conv;
37469         obj_conv.inner = untag_ptr(obj);
37470         obj_conv.is_owned = ptr_is_owned(obj);
37471         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37472         obj_conv.is_owned = false;
37473         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
37474         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37475         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37476         CVec_u8Z_free(ret_var);
37477         return ret_arr;
37478 }
37479
37480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37481         LDKu8slice ser_ref;
37482         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37483         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37484         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
37485         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
37486         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37487         return tag_ptr(ret_conv, true);
37488 }
37489
37490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37491         if (!ptr_is_owned(this_ptr)) return;
37492         void* this_ptr_ptr = untag_ptr(this_ptr);
37493         CHECK_ACCESS(this_ptr_ptr);
37494         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
37495         FREE(untag_ptr(this_ptr));
37496         MonitorEvent_free(this_ptr_conv);
37497 }
37498
37499 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
37500         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37501         *ret_copy = MonitorEvent_clone(arg);
37502         int64_t ret_ref = tag_ptr(ret_copy, true);
37503         return ret_ref;
37504 }
37505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37506         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
37507         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
37508         return ret_conv;
37509 }
37510
37511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37512         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
37513         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37514         *ret_copy = MonitorEvent_clone(orig_conv);
37515         int64_t ret_ref = tag_ptr(ret_copy, true);
37516         return ret_ref;
37517 }
37518
37519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
37520         LDKHTLCUpdate a_conv;
37521         a_conv.inner = untag_ptr(a);
37522         a_conv.is_owned = ptr_is_owned(a);
37523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37524         a_conv = HTLCUpdate_clone(&a_conv);
37525         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37526         *ret_copy = MonitorEvent_htlcevent(a_conv);
37527         int64_t ret_ref = tag_ptr(ret_copy, true);
37528         return ret_ref;
37529 }
37530
37531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
37532         LDKOutPoint a_conv;
37533         a_conv.inner = untag_ptr(a);
37534         a_conv.is_owned = ptr_is_owned(a);
37535         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37536         a_conv = OutPoint_clone(&a_conv);
37537         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37538         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
37539         int64_t ret_ref = tag_ptr(ret_copy, true);
37540         return ret_ref;
37541 }
37542
37543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
37544         LDKOutPoint funding_txo_conv;
37545         funding_txo_conv.inner = untag_ptr(funding_txo);
37546         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37548         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37549         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37550         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
37551         int64_t ret_ref = tag_ptr(ret_copy, true);
37552         return ret_ref;
37553 }
37554
37555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37556         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
37557         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
37558         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
37559         return ret_conv;
37560 }
37561
37562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
37563         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
37564         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
37565         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37566         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37567         CVec_u8Z_free(ret_var);
37568         return ret_arr;
37569 }
37570
37571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37572         LDKu8slice ser_ref;
37573         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37574         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37575         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
37576         *ret_conv = MonitorEvent_read(ser_ref);
37577         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37578         return tag_ptr(ret_conv, true);
37579 }
37580
37581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37582         LDKHTLCUpdate this_obj_conv;
37583         this_obj_conv.inner = untag_ptr(this_obj);
37584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37586         HTLCUpdate_free(this_obj_conv);
37587 }
37588
37589 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
37590         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
37591         int64_t ret_ref = 0;
37592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37594         return ret_ref;
37595 }
37596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37597         LDKHTLCUpdate arg_conv;
37598         arg_conv.inner = untag_ptr(arg);
37599         arg_conv.is_owned = ptr_is_owned(arg);
37600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37601         arg_conv.is_owned = false;
37602         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
37603         return ret_conv;
37604 }
37605
37606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37607         LDKHTLCUpdate orig_conv;
37608         orig_conv.inner = untag_ptr(orig);
37609         orig_conv.is_owned = ptr_is_owned(orig);
37610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37611         orig_conv.is_owned = false;
37612         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
37613         int64_t ret_ref = 0;
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37616         return ret_ref;
37617 }
37618
37619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37620         LDKHTLCUpdate a_conv;
37621         a_conv.inner = untag_ptr(a);
37622         a_conv.is_owned = ptr_is_owned(a);
37623         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37624         a_conv.is_owned = false;
37625         LDKHTLCUpdate b_conv;
37626         b_conv.inner = untag_ptr(b);
37627         b_conv.is_owned = ptr_is_owned(b);
37628         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37629         b_conv.is_owned = false;
37630         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
37631         return ret_conv;
37632 }
37633
37634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37635         LDKHTLCUpdate obj_conv;
37636         obj_conv.inner = untag_ptr(obj);
37637         obj_conv.is_owned = ptr_is_owned(obj);
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37639         obj_conv.is_owned = false;
37640         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
37641         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37642         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37643         CVec_u8Z_free(ret_var);
37644         return ret_arr;
37645 }
37646
37647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37648         LDKu8slice ser_ref;
37649         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37650         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37651         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
37652         *ret_conv = HTLCUpdate_read(ser_ref);
37653         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37654         return tag_ptr(ret_conv, true);
37655 }
37656
37657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37658         if (!ptr_is_owned(this_ptr)) return;
37659         void* this_ptr_ptr = untag_ptr(this_ptr);
37660         CHECK_ACCESS(this_ptr_ptr);
37661         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
37662         FREE(untag_ptr(this_ptr));
37663         Balance_free(this_ptr_conv);
37664 }
37665
37666 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
37667         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37668         *ret_copy = Balance_clone(arg);
37669         int64_t ret_ref = tag_ptr(ret_copy, true);
37670         return ret_ref;
37671 }
37672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37673         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
37674         int64_t ret_conv = Balance_clone_ptr(arg_conv);
37675         return ret_conv;
37676 }
37677
37678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37679         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
37680         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37681         *ret_copy = Balance_clone(orig_conv);
37682         int64_t ret_ref = tag_ptr(ret_copy, true);
37683         return ret_ref;
37684 }
37685
37686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
37687         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37688         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
37689         int64_t ret_ref = tag_ptr(ret_copy, true);
37690         return ret_ref;
37691 }
37692
37693 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) {
37694         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37695         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
37696         int64_t ret_ref = tag_ptr(ret_copy, true);
37697         return ret_ref;
37698 }
37699
37700 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) {
37701         LDKThirtyTwoBytes payment_hash_ref;
37702         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37703         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37704         LDKThirtyTwoBytes payment_preimage_ref;
37705         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
37706         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
37707         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37708         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
37709         int64_t ret_ref = tag_ptr(ret_copy, true);
37710         return ret_ref;
37711 }
37712
37713 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) {
37714         LDKThirtyTwoBytes payment_hash_ref;
37715         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37716         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37717         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37718         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
37719         int64_t ret_ref = tag_ptr(ret_copy, true);
37720         return ret_ref;
37721 }
37722
37723 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) {
37724         LDKThirtyTwoBytes payment_hash_ref;
37725         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37726         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37727         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37728         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
37729         int64_t ret_ref = tag_ptr(ret_copy, true);
37730         return ret_ref;
37731 }
37732
37733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
37734         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37735         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
37736         int64_t ret_ref = tag_ptr(ret_copy, true);
37737         return ret_ref;
37738 }
37739
37740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37741         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
37742         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
37743         jboolean ret_conv = Balance_eq(a_conv, b_conv);
37744         return ret_conv;
37745 }
37746
37747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
37748         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
37749         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
37750         return ret_conv;
37751 }
37752
37753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37754         LDKChannelMonitor this_obj_conv;
37755         this_obj_conv.inner = untag_ptr(this_obj);
37756         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37758         ChannelMonitor_free(this_obj_conv);
37759 }
37760
37761 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
37762         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
37763         int64_t ret_ref = 0;
37764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37766         return ret_ref;
37767 }
37768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37769         LDKChannelMonitor arg_conv;
37770         arg_conv.inner = untag_ptr(arg);
37771         arg_conv.is_owned = ptr_is_owned(arg);
37772         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37773         arg_conv.is_owned = false;
37774         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
37775         return ret_conv;
37776 }
37777
37778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37779         LDKChannelMonitor orig_conv;
37780         orig_conv.inner = untag_ptr(orig);
37781         orig_conv.is_owned = ptr_is_owned(orig);
37782         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37783         orig_conv.is_owned = false;
37784         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
37785         int64_t ret_ref = 0;
37786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37788         return ret_ref;
37789 }
37790
37791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
37792         LDKChannelMonitor obj_conv;
37793         obj_conv.inner = untag_ptr(obj);
37794         obj_conv.is_owned = ptr_is_owned(obj);
37795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37796         obj_conv.is_owned = false;
37797         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
37798         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37799         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37800         CVec_u8Z_free(ret_var);
37801         return ret_arr;
37802 }
37803
37804 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) {
37805         LDKChannelMonitor this_arg_conv;
37806         this_arg_conv.inner = untag_ptr(this_arg);
37807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37809         this_arg_conv.is_owned = false;
37810         LDKChannelMonitorUpdate updates_conv;
37811         updates_conv.inner = untag_ptr(updates);
37812         updates_conv.is_owned = ptr_is_owned(updates);
37813         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
37814         updates_conv.is_owned = false;
37815         void* broadcaster_ptr = untag_ptr(broadcaster);
37816         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
37817         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
37818         void* fee_estimator_ptr = untag_ptr(fee_estimator);
37819         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
37820         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
37821         void* logger_ptr = untag_ptr(logger);
37822         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
37823         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
37824         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37825         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
37826         return tag_ptr(ret_conv, true);
37827 }
37828
37829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
37830         LDKChannelMonitor this_arg_conv;
37831         this_arg_conv.inner = untag_ptr(this_arg);
37832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37834         this_arg_conv.is_owned = false;
37835         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
37836         return ret_conv;
37837 }
37838
37839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
37840         LDKChannelMonitor this_arg_conv;
37841         this_arg_conv.inner = untag_ptr(this_arg);
37842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37844         this_arg_conv.is_owned = false;
37845         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
37846         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
37847         return tag_ptr(ret_conv, true);
37848 }
37849
37850 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
37851         LDKChannelMonitor this_arg_conv;
37852         this_arg_conv.inner = untag_ptr(this_arg);
37853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37855         this_arg_conv.is_owned = false;
37856         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
37857         int64_tArray ret_arr = NULL;
37858         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37859         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37860         for (size_t a = 0; a < ret_var.datalen; a++) {
37861                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
37862                 *ret_conv_52_conv = ret_var.data[a];
37863                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
37864         }
37865         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37866         FREE(ret_var.data);
37867         return ret_arr;
37868 }
37869
37870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
37871         LDKChannelMonitor 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* filter_ptr = untag_ptr(filter);
37877         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
37878         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
37879         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
37880 }
37881
37882 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37883         LDKChannelMonitor this_arg_conv;
37884         this_arg_conv.inner = untag_ptr(this_arg);
37885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37887         this_arg_conv.is_owned = false;
37888         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
37889         int64_tArray ret_arr = NULL;
37890         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37891         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37892         for (size_t o = 0; o < ret_var.datalen; o++) {
37893                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37894                 *ret_conv_14_copy = ret_var.data[o];
37895                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
37896                 ret_arr_ptr[o] = ret_conv_14_ref;
37897         }
37898         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37899         FREE(ret_var.data);
37900         return ret_arr;
37901 }
37902
37903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
37904         LDKChannelMonitor this_arg_conv;
37905         this_arg_conv.inner = untag_ptr(this_arg);
37906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37908         this_arg_conv.is_owned = false;
37909         void* handler_ptr = untag_ptr(handler);
37910         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
37911         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
37912         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
37913 }
37914
37915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
37916         LDKChannelMonitor this_arg_conv;
37917         this_arg_conv.inner = untag_ptr(this_arg);
37918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37920         this_arg_conv.is_owned = false;
37921         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
37922         int64_t ret_ref = 0;
37923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37925         return ret_ref;
37926 }
37927
37928 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) {
37929         LDKChannelMonitor this_arg_conv;
37930         this_arg_conv.inner = untag_ptr(this_arg);
37931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37933         this_arg_conv.is_owned = false;
37934         LDKChannelMonitorUpdate update_conv;
37935         update_conv.inner = untag_ptr(update);
37936         update_conv.is_owned = ptr_is_owned(update);
37937         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
37938         update_conv.is_owned = false;
37939         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
37940         int64_tArray ret_arr = NULL;
37941         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37942         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37943         for (size_t x = 0; x < ret_var.datalen; x++) {
37944                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
37945                 int64_t ret_conv_23_ref = 0;
37946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
37947                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
37948                 ret_arr_ptr[x] = ret_conv_23_ref;
37949         }
37950         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37951         FREE(ret_var.data);
37952         return ret_arr;
37953 }
37954
37955 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) {
37956         LDKChannelMonitor this_arg_conv;
37957         this_arg_conv.inner = untag_ptr(this_arg);
37958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37960         this_arg_conv.is_owned = false;
37961         LDKTransaction justice_tx_ref;
37962         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
37963         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
37964         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
37965         justice_tx_ref.data_is_owned = true;
37966         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
37967         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
37968         return tag_ptr(ret_conv, true);
37969 }
37970
37971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
37972         LDKChannelMonitor this_arg_conv;
37973         this_arg_conv.inner = untag_ptr(this_arg);
37974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37976         this_arg_conv.is_owned = false;
37977         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37978         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
37979         return ret_arr;
37980 }
37981
37982 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) {
37983         LDKChannelMonitor this_arg_conv;
37984         this_arg_conv.inner = untag_ptr(this_arg);
37985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37987         this_arg_conv.is_owned = false;
37988         void* logger_ptr = untag_ptr(logger);
37989         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
37990         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
37991         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
37992         jobjectArray ret_arr = NULL;
37993         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37994         ;
37995         for (size_t i = 0; i < ret_var.datalen; i++) {
37996                 LDKTransaction ret_conv_8_var = ret_var.data[i];
37997                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
37998                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
37999                 Transaction_free(ret_conv_8_var);
38000                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38001         }
38002         
38003         FREE(ret_var.data);
38004         return ret_arr;
38005 }
38006
38007 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) {
38008         LDKChannelMonitor this_arg_conv;
38009         this_arg_conv.inner = untag_ptr(this_arg);
38010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38012         this_arg_conv.is_owned = false;
38013         uint8_t header_arr[80];
38014         CHECK((*env)->GetArrayLength(env, header) == 80);
38015         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38016         uint8_t (*header_ref)[80] = &header_arr;
38017         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38018         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38019         if (txdata_constr.datalen > 0)
38020                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38021         else
38022                 txdata_constr.data = NULL;
38023         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38024         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38025                 int64_t txdata_conv_28 = txdata_vals[c];
38026                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38027                 CHECK_ACCESS(txdata_conv_28_ptr);
38028                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38029                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38030                 txdata_constr.data[c] = txdata_conv_28_conv;
38031         }
38032         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38033         void* broadcaster_ptr = untag_ptr(broadcaster);
38034         CHECK_ACCESS(broadcaster_ptr);
38035         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38036         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38037                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38038                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38039         }
38040         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38041         CHECK_ACCESS(fee_estimator_ptr);
38042         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38043         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38044                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38045                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38046         }
38047         void* logger_ptr = untag_ptr(logger);
38048         CHECK_ACCESS(logger_ptr);
38049         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38050         if (logger_conv.free == LDKLogger_JCalls_free) {
38051                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38052                 LDKLogger_JCalls_cloned(&logger_conv);
38053         }
38054         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);
38055         int64_tArray ret_arr = NULL;
38056         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38057         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38058         for (size_t x = 0; x < ret_var.datalen; x++) {
38059                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38060                 *ret_conv_49_conv = ret_var.data[x];
38061                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38062         }
38063         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38064         FREE(ret_var.data);
38065         return ret_arr;
38066 }
38067
38068 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) {
38069         LDKChannelMonitor this_arg_conv;
38070         this_arg_conv.inner = untag_ptr(this_arg);
38071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38073         this_arg_conv.is_owned = false;
38074         uint8_t header_arr[80];
38075         CHECK((*env)->GetArrayLength(env, header) == 80);
38076         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38077         uint8_t (*header_ref)[80] = &header_arr;
38078         void* broadcaster_ptr = untag_ptr(broadcaster);
38079         CHECK_ACCESS(broadcaster_ptr);
38080         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38081         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38083                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38084         }
38085         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38086         CHECK_ACCESS(fee_estimator_ptr);
38087         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38088         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38090                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38091         }
38092         void* logger_ptr = untag_ptr(logger);
38093         CHECK_ACCESS(logger_ptr);
38094         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38095         if (logger_conv.free == LDKLogger_JCalls_free) {
38096                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38097                 LDKLogger_JCalls_cloned(&logger_conv);
38098         }
38099         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38100 }
38101
38102 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) {
38103         LDKChannelMonitor this_arg_conv;
38104         this_arg_conv.inner = untag_ptr(this_arg);
38105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38107         this_arg_conv.is_owned = false;
38108         uint8_t header_arr[80];
38109         CHECK((*env)->GetArrayLength(env, header) == 80);
38110         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38111         uint8_t (*header_ref)[80] = &header_arr;
38112         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38113         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38114         if (txdata_constr.datalen > 0)
38115                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38116         else
38117                 txdata_constr.data = NULL;
38118         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38119         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38120                 int64_t txdata_conv_28 = txdata_vals[c];
38121                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38122                 CHECK_ACCESS(txdata_conv_28_ptr);
38123                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38124                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38125                 txdata_constr.data[c] = txdata_conv_28_conv;
38126         }
38127         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38128         void* broadcaster_ptr = untag_ptr(broadcaster);
38129         CHECK_ACCESS(broadcaster_ptr);
38130         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38131         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38132                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38133                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38134         }
38135         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38136         CHECK_ACCESS(fee_estimator_ptr);
38137         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38138         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38140                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38141         }
38142         void* logger_ptr = untag_ptr(logger);
38143         CHECK_ACCESS(logger_ptr);
38144         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38145         if (logger_conv.free == LDKLogger_JCalls_free) {
38146                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38147                 LDKLogger_JCalls_cloned(&logger_conv);
38148         }
38149         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);
38150         int64_tArray ret_arr = NULL;
38151         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38152         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38153         for (size_t x = 0; x < ret_var.datalen; x++) {
38154                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38155                 *ret_conv_49_conv = ret_var.data[x];
38156                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38157         }
38158         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38159         FREE(ret_var.data);
38160         return ret_arr;
38161 }
38162
38163 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) {
38164         LDKChannelMonitor this_arg_conv;
38165         this_arg_conv.inner = untag_ptr(this_arg);
38166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38168         this_arg_conv.is_owned = false;
38169         uint8_t txid_arr[32];
38170         CHECK((*env)->GetArrayLength(env, txid) == 32);
38171         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
38172         uint8_t (*txid_ref)[32] = &txid_arr;
38173         void* broadcaster_ptr = untag_ptr(broadcaster);
38174         CHECK_ACCESS(broadcaster_ptr);
38175         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38176         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38177                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38178                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38179         }
38180         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38181         CHECK_ACCESS(fee_estimator_ptr);
38182         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38183         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38184                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38185                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38186         }
38187         void* logger_ptr = untag_ptr(logger);
38188         CHECK_ACCESS(logger_ptr);
38189         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38190         if (logger_conv.free == LDKLogger_JCalls_free) {
38191                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38192                 LDKLogger_JCalls_cloned(&logger_conv);
38193         }
38194         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
38195 }
38196
38197 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) {
38198         LDKChannelMonitor this_arg_conv;
38199         this_arg_conv.inner = untag_ptr(this_arg);
38200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38202         this_arg_conv.is_owned = false;
38203         uint8_t header_arr[80];
38204         CHECK((*env)->GetArrayLength(env, header) == 80);
38205         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38206         uint8_t (*header_ref)[80] = &header_arr;
38207         void* broadcaster_ptr = untag_ptr(broadcaster);
38208         CHECK_ACCESS(broadcaster_ptr);
38209         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38210         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38211                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38212                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38213         }
38214         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38215         CHECK_ACCESS(fee_estimator_ptr);
38216         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38217         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38218                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38219                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38220         }
38221         void* logger_ptr = untag_ptr(logger);
38222         CHECK_ACCESS(logger_ptr);
38223         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38224         if (logger_conv.free == LDKLogger_JCalls_free) {
38225                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38226                 LDKLogger_JCalls_cloned(&logger_conv);
38227         }
38228         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38229         int64_tArray ret_arr = NULL;
38230         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38231         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38232         for (size_t x = 0; x < ret_var.datalen; x++) {
38233                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38234                 *ret_conv_49_conv = ret_var.data[x];
38235                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38236         }
38237         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38238         FREE(ret_var.data);
38239         return ret_arr;
38240 }
38241
38242 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
38243         LDKChannelMonitor this_arg_conv;
38244         this_arg_conv.inner = untag_ptr(this_arg);
38245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38247         this_arg_conv.is_owned = false;
38248         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
38249         int64_tArray ret_arr = NULL;
38250         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38251         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38252         for (size_t x = 0; x < ret_var.datalen; x++) {
38253                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
38254                 *ret_conv_49_conv = ret_var.data[x];
38255                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38256         }
38257         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38258         FREE(ret_var.data);
38259         return ret_arr;
38260 }
38261
38262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
38263         LDKChannelMonitor this_arg_conv;
38264         this_arg_conv.inner = untag_ptr(this_arg);
38265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38267         this_arg_conv.is_owned = false;
38268         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
38269         int64_t ret_ref = 0;
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38272         return ret_ref;
38273 }
38274
38275 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) {
38276         LDKChannelMonitor this_arg_conv;
38277         this_arg_conv.inner = untag_ptr(this_arg);
38278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38280         this_arg_conv.is_owned = false;
38281         void* broadcaster_ptr = untag_ptr(broadcaster);
38282         CHECK_ACCESS(broadcaster_ptr);
38283         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38284         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38286                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38287         }
38288         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38289         CHECK_ACCESS(fee_estimator_ptr);
38290         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38291         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38292                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38293                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38294         }
38295         void* logger_ptr = untag_ptr(logger);
38296         CHECK_ACCESS(logger_ptr);
38297         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38298         if (logger_conv.free == LDKLogger_JCalls_free) {
38299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38300                 LDKLogger_JCalls_cloned(&logger_conv);
38301         }
38302         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
38303 }
38304
38305 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) {
38306         LDKChannelMonitor this_arg_conv;
38307         this_arg_conv.inner = untag_ptr(this_arg);
38308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38310         this_arg_conv.is_owned = false;
38311         LDKTransaction tx_ref;
38312         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
38313         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
38314         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
38315         tx_ref.data_is_owned = true;
38316         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
38317         int64_tArray ret_arr = NULL;
38318         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38319         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38320         for (size_t b = 0; b < ret_var.datalen; b++) {
38321                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
38322                 *ret_conv_27_copy = ret_var.data[b];
38323                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
38324                 ret_arr_ptr[b] = ret_conv_27_ref;
38325         }
38326         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38327         FREE(ret_var.data);
38328         return ret_arr;
38329 }
38330
38331 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
38332         LDKChannelMonitor this_arg_conv;
38333         this_arg_conv.inner = untag_ptr(this_arg);
38334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38336         this_arg_conv.is_owned = false;
38337         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
38338         int64_tArray ret_arr = NULL;
38339         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38340         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38341         for (size_t j = 0; j < ret_var.datalen; j++) {
38342                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38343                 *ret_conv_9_copy = ret_var.data[j];
38344                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38345                 ret_arr_ptr[j] = ret_conv_9_ref;
38346         }
38347         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38348         FREE(ret_var.data);
38349         return ret_arr;
38350 }
38351
38352 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) {
38353         LDKu8slice ser_ref;
38354         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38355         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38356         void* arg_a_ptr = untag_ptr(arg_a);
38357         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
38358         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
38359         void* arg_b_ptr = untag_ptr(arg_b);
38360         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
38361         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
38362         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
38363         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
38364         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38365         return tag_ptr(ret_conv, true);
38366 }
38367
38368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38369         LDKOutPoint this_obj_conv;
38370         this_obj_conv.inner = untag_ptr(this_obj);
38371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38373         OutPoint_free(this_obj_conv);
38374 }
38375
38376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38377         LDKOutPoint this_ptr_conv;
38378         this_ptr_conv.inner = untag_ptr(this_ptr);
38379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38381         this_ptr_conv.is_owned = false;
38382         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38383         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
38384         return ret_arr;
38385 }
38386
38387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38388         LDKOutPoint this_ptr_conv;
38389         this_ptr_conv.inner = untag_ptr(this_ptr);
38390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38392         this_ptr_conv.is_owned = false;
38393         LDKThirtyTwoBytes val_ref;
38394         CHECK((*env)->GetArrayLength(env, val) == 32);
38395         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38396         OutPoint_set_txid(&this_ptr_conv, val_ref);
38397 }
38398
38399 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38400         LDKOutPoint this_ptr_conv;
38401         this_ptr_conv.inner = untag_ptr(this_ptr);
38402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38404         this_ptr_conv.is_owned = false;
38405         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
38406         return ret_conv;
38407 }
38408
38409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38410         LDKOutPoint this_ptr_conv;
38411         this_ptr_conv.inner = untag_ptr(this_ptr);
38412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38414         this_ptr_conv.is_owned = false;
38415         OutPoint_set_index(&this_ptr_conv, val);
38416 }
38417
38418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
38419         LDKThirtyTwoBytes txid_arg_ref;
38420         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38421         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38422         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
38423         int64_t ret_ref = 0;
38424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38426         return ret_ref;
38427 }
38428
38429 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
38430         LDKOutPoint ret_var = OutPoint_clone(arg);
38431         int64_t ret_ref = 0;
38432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38434         return ret_ref;
38435 }
38436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38437         LDKOutPoint arg_conv;
38438         arg_conv.inner = untag_ptr(arg);
38439         arg_conv.is_owned = ptr_is_owned(arg);
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38441         arg_conv.is_owned = false;
38442         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
38443         return ret_conv;
38444 }
38445
38446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38447         LDKOutPoint orig_conv;
38448         orig_conv.inner = untag_ptr(orig);
38449         orig_conv.is_owned = ptr_is_owned(orig);
38450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38451         orig_conv.is_owned = false;
38452         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
38453         int64_t ret_ref = 0;
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38456         return ret_ref;
38457 }
38458
38459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38460         LDKOutPoint a_conv;
38461         a_conv.inner = untag_ptr(a);
38462         a_conv.is_owned = ptr_is_owned(a);
38463         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38464         a_conv.is_owned = false;
38465         LDKOutPoint b_conv;
38466         b_conv.inner = untag_ptr(b);
38467         b_conv.is_owned = ptr_is_owned(b);
38468         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38469         b_conv.is_owned = false;
38470         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
38471         return ret_conv;
38472 }
38473
38474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
38475         LDKOutPoint o_conv;
38476         o_conv.inner = untag_ptr(o);
38477         o_conv.is_owned = ptr_is_owned(o);
38478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38479         o_conv.is_owned = false;
38480         int64_t ret_conv = OutPoint_hash(&o_conv);
38481         return ret_conv;
38482 }
38483
38484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38485         LDKOutPoint this_arg_conv;
38486         this_arg_conv.inner = untag_ptr(this_arg);
38487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38489         this_arg_conv.is_owned = false;
38490         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38491         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
38492         return ret_arr;
38493 }
38494
38495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
38496         LDKOutPoint obj_conv;
38497         obj_conv.inner = untag_ptr(obj);
38498         obj_conv.is_owned = ptr_is_owned(obj);
38499         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38500         obj_conv.is_owned = false;
38501         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
38502         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38503         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38504         CVec_u8Z_free(ret_var);
38505         return ret_arr;
38506 }
38507
38508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38509         LDKu8slice ser_ref;
38510         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38511         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38512         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38513         *ret_conv = OutPoint_read(ser_ref);
38514         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38515         return tag_ptr(ret_conv, true);
38516 }
38517
38518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38519         if (!ptr_is_owned(this_ptr)) return;
38520         void* this_ptr_ptr = untag_ptr(this_ptr);
38521         CHECK_ACCESS(this_ptr_ptr);
38522         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
38523         FREE(untag_ptr(this_ptr));
38524         FailureCode_free(this_ptr_conv);
38525 }
38526
38527 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
38528         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38529         *ret_copy = FailureCode_clone(arg);
38530         int64_t ret_ref = tag_ptr(ret_copy, true);
38531         return ret_ref;
38532 }
38533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38534         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
38535         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
38536         return ret_conv;
38537 }
38538
38539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38540         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
38541         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38542         *ret_copy = FailureCode_clone(orig_conv);
38543         int64_t ret_ref = tag_ptr(ret_copy, true);
38544         return ret_ref;
38545 }
38546
38547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
38548         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38549         *ret_copy = FailureCode_temporary_node_failure();
38550         int64_t ret_ref = tag_ptr(ret_copy, true);
38551         return ret_ref;
38552 }
38553
38554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
38555         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38556         *ret_copy = FailureCode_required_node_feature_missing();
38557         int64_t ret_ref = tag_ptr(ret_copy, true);
38558         return ret_ref;
38559 }
38560
38561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
38562         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38563         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
38564         int64_t ret_ref = tag_ptr(ret_copy, true);
38565         return ret_ref;
38566 }
38567
38568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
38569         void* a_ptr = untag_ptr(a);
38570         CHECK_ACCESS(a_ptr);
38571         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
38572         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
38573         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38574         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
38575         int64_t ret_ref = tag_ptr(ret_copy, true);
38576         return ret_ref;
38577 }
38578
38579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38580         LDKChannelManager this_obj_conv;
38581         this_obj_conv.inner = untag_ptr(this_obj);
38582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38584         ChannelManager_free(this_obj_conv);
38585 }
38586
38587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38588         LDKChainParameters this_obj_conv;
38589         this_obj_conv.inner = untag_ptr(this_obj);
38590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38592         ChainParameters_free(this_obj_conv);
38593 }
38594
38595 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
38596         LDKChainParameters this_ptr_conv;
38597         this_ptr_conv.inner = untag_ptr(this_ptr);
38598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38600         this_ptr_conv.is_owned = false;
38601         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
38602         return ret_conv;
38603 }
38604
38605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38606         LDKChainParameters this_ptr_conv;
38607         this_ptr_conv.inner = untag_ptr(this_ptr);
38608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38610         this_ptr_conv.is_owned = false;
38611         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
38612         ChainParameters_set_network(&this_ptr_conv, val_conv);
38613 }
38614
38615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
38616         LDKChainParameters this_ptr_conv;
38617         this_ptr_conv.inner = untag_ptr(this_ptr);
38618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38620         this_ptr_conv.is_owned = false;
38621         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
38622         int64_t ret_ref = 0;
38623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38625         return ret_ref;
38626 }
38627
38628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38629         LDKChainParameters this_ptr_conv;
38630         this_ptr_conv.inner = untag_ptr(this_ptr);
38631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38633         this_ptr_conv.is_owned = false;
38634         LDKBestBlock val_conv;
38635         val_conv.inner = untag_ptr(val);
38636         val_conv.is_owned = ptr_is_owned(val);
38637         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38638         val_conv = BestBlock_clone(&val_conv);
38639         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
38640 }
38641
38642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
38643         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
38644         LDKBestBlock best_block_arg_conv;
38645         best_block_arg_conv.inner = untag_ptr(best_block_arg);
38646         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
38648         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
38649         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
38650         int64_t ret_ref = 0;
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38653         return ret_ref;
38654 }
38655
38656 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
38657         LDKChainParameters ret_var = ChainParameters_clone(arg);
38658         int64_t ret_ref = 0;
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38661         return ret_ref;
38662 }
38663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38664         LDKChainParameters arg_conv;
38665         arg_conv.inner = untag_ptr(arg);
38666         arg_conv.is_owned = ptr_is_owned(arg);
38667         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38668         arg_conv.is_owned = false;
38669         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
38670         return ret_conv;
38671 }
38672
38673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38674         LDKChainParameters orig_conv;
38675         orig_conv.inner = untag_ptr(orig);
38676         orig_conv.is_owned = ptr_is_owned(orig);
38677         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38678         orig_conv.is_owned = false;
38679         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
38680         int64_t ret_ref = 0;
38681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38683         return ret_ref;
38684 }
38685
38686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38687         LDKCounterpartyForwardingInfo this_obj_conv;
38688         this_obj_conv.inner = untag_ptr(this_obj);
38689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38691         CounterpartyForwardingInfo_free(this_obj_conv);
38692 }
38693
38694 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38695         LDKCounterpartyForwardingInfo this_ptr_conv;
38696         this_ptr_conv.inner = untag_ptr(this_ptr);
38697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38699         this_ptr_conv.is_owned = false;
38700         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
38701         return ret_conv;
38702 }
38703
38704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38705         LDKCounterpartyForwardingInfo this_ptr_conv;
38706         this_ptr_conv.inner = untag_ptr(this_ptr);
38707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38709         this_ptr_conv.is_owned = false;
38710         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
38711 }
38712
38713 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
38714         LDKCounterpartyForwardingInfo this_ptr_conv;
38715         this_ptr_conv.inner = untag_ptr(this_ptr);
38716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38718         this_ptr_conv.is_owned = false;
38719         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
38720         return ret_conv;
38721 }
38722
38723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38724         LDKCounterpartyForwardingInfo this_ptr_conv;
38725         this_ptr_conv.inner = untag_ptr(this_ptr);
38726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38728         this_ptr_conv.is_owned = false;
38729         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
38730 }
38731
38732 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
38733         LDKCounterpartyForwardingInfo this_ptr_conv;
38734         this_ptr_conv.inner = untag_ptr(this_ptr);
38735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38737         this_ptr_conv.is_owned = false;
38738         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
38739         return ret_conv;
38740 }
38741
38742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38743         LDKCounterpartyForwardingInfo this_ptr_conv;
38744         this_ptr_conv.inner = untag_ptr(this_ptr);
38745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38747         this_ptr_conv.is_owned = false;
38748         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
38749 }
38750
38751 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) {
38752         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
38753         int64_t ret_ref = 0;
38754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38756         return ret_ref;
38757 }
38758
38759 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
38760         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
38761         int64_t ret_ref = 0;
38762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38764         return ret_ref;
38765 }
38766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38767         LDKCounterpartyForwardingInfo arg_conv;
38768         arg_conv.inner = untag_ptr(arg);
38769         arg_conv.is_owned = ptr_is_owned(arg);
38770         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38771         arg_conv.is_owned = false;
38772         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
38773         return ret_conv;
38774 }
38775
38776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38777         LDKCounterpartyForwardingInfo orig_conv;
38778         orig_conv.inner = untag_ptr(orig);
38779         orig_conv.is_owned = ptr_is_owned(orig);
38780         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38781         orig_conv.is_owned = false;
38782         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
38783         int64_t ret_ref = 0;
38784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38786         return ret_ref;
38787 }
38788
38789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38790         LDKChannelCounterparty this_obj_conv;
38791         this_obj_conv.inner = untag_ptr(this_obj);
38792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38794         ChannelCounterparty_free(this_obj_conv);
38795 }
38796
38797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38798         LDKChannelCounterparty this_ptr_conv;
38799         this_ptr_conv.inner = untag_ptr(this_ptr);
38800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38802         this_ptr_conv.is_owned = false;
38803         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38804         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
38805         return ret_arr;
38806 }
38807
38808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38809         LDKChannelCounterparty this_ptr_conv;
38810         this_ptr_conv.inner = untag_ptr(this_ptr);
38811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38813         this_ptr_conv.is_owned = false;
38814         LDKPublicKey val_ref;
38815         CHECK((*env)->GetArrayLength(env, val) == 33);
38816         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38817         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
38818 }
38819
38820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38821         LDKChannelCounterparty this_ptr_conv;
38822         this_ptr_conv.inner = untag_ptr(this_ptr);
38823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38825         this_ptr_conv.is_owned = false;
38826         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
38827         int64_t ret_ref = 0;
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38830         return ret_ref;
38831 }
38832
38833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38834         LDKChannelCounterparty this_ptr_conv;
38835         this_ptr_conv.inner = untag_ptr(this_ptr);
38836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38838         this_ptr_conv.is_owned = false;
38839         LDKInitFeatures val_conv;
38840         val_conv.inner = untag_ptr(val);
38841         val_conv.is_owned = ptr_is_owned(val);
38842         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38843         val_conv = InitFeatures_clone(&val_conv);
38844         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
38845 }
38846
38847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
38848         LDKChannelCounterparty this_ptr_conv;
38849         this_ptr_conv.inner = untag_ptr(this_ptr);
38850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38852         this_ptr_conv.is_owned = false;
38853         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
38854         return ret_conv;
38855 }
38856
38857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38858         LDKChannelCounterparty this_ptr_conv;
38859         this_ptr_conv.inner = untag_ptr(this_ptr);
38860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38862         this_ptr_conv.is_owned = false;
38863         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
38864 }
38865
38866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
38867         LDKChannelCounterparty this_ptr_conv;
38868         this_ptr_conv.inner = untag_ptr(this_ptr);
38869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38871         this_ptr_conv.is_owned = false;
38872         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
38873         int64_t ret_ref = 0;
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38876         return ret_ref;
38877 }
38878
38879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38880         LDKChannelCounterparty this_ptr_conv;
38881         this_ptr_conv.inner = untag_ptr(this_ptr);
38882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38884         this_ptr_conv.is_owned = false;
38885         LDKCounterpartyForwardingInfo val_conv;
38886         val_conv.inner = untag_ptr(val);
38887         val_conv.is_owned = ptr_is_owned(val);
38888         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38889         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
38890         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
38891 }
38892
38893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38894         LDKChannelCounterparty this_ptr_conv;
38895         this_ptr_conv.inner = untag_ptr(this_ptr);
38896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38898         this_ptr_conv.is_owned = false;
38899         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38900         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
38901         int64_t ret_ref = tag_ptr(ret_copy, true);
38902         return ret_ref;
38903 }
38904
38905 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) {
38906         LDKChannelCounterparty this_ptr_conv;
38907         this_ptr_conv.inner = untag_ptr(this_ptr);
38908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38910         this_ptr_conv.is_owned = false;
38911         void* val_ptr = untag_ptr(val);
38912         CHECK_ACCESS(val_ptr);
38913         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38914         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38915         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
38916 }
38917
38918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38919         LDKChannelCounterparty 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38925         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
38926         int64_t ret_ref = tag_ptr(ret_copy, true);
38927         return ret_ref;
38928 }
38929
38930 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) {
38931         LDKChannelCounterparty this_ptr_conv;
38932         this_ptr_conv.inner = untag_ptr(this_ptr);
38933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38935         this_ptr_conv.is_owned = false;
38936         void* val_ptr = untag_ptr(val);
38937         CHECK_ACCESS(val_ptr);
38938         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38939         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38940         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
38941 }
38942
38943 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) {
38944         LDKPublicKey node_id_arg_ref;
38945         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
38946         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
38947         LDKInitFeatures features_arg_conv;
38948         features_arg_conv.inner = untag_ptr(features_arg);
38949         features_arg_conv.is_owned = ptr_is_owned(features_arg);
38950         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
38951         features_arg_conv = InitFeatures_clone(&features_arg_conv);
38952         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
38953         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
38954         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
38955         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
38956         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
38957         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
38958         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
38959         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
38960         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
38961         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
38962         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
38963         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
38964         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
38965         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);
38966         int64_t ret_ref = 0;
38967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38969         return ret_ref;
38970 }
38971
38972 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
38973         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
38974         int64_t ret_ref = 0;
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38977         return ret_ref;
38978 }
38979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38980         LDKChannelCounterparty arg_conv;
38981         arg_conv.inner = untag_ptr(arg);
38982         arg_conv.is_owned = ptr_is_owned(arg);
38983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38984         arg_conv.is_owned = false;
38985         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
38986         return ret_conv;
38987 }
38988
38989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38990         LDKChannelCounterparty orig_conv;
38991         orig_conv.inner = untag_ptr(orig);
38992         orig_conv.is_owned = ptr_is_owned(orig);
38993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38994         orig_conv.is_owned = false;
38995         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
38996         int64_t ret_ref = 0;
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38999         return ret_ref;
39000 }
39001
39002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39003         LDKChannelDetails this_obj_conv;
39004         this_obj_conv.inner = untag_ptr(this_obj);
39005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39007         ChannelDetails_free(this_obj_conv);
39008 }
39009
39010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39011         LDKChannelDetails this_ptr_conv;
39012         this_ptr_conv.inner = untag_ptr(this_ptr);
39013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39015         this_ptr_conv.is_owned = false;
39016         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39017         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
39018         return ret_arr;
39019 }
39020
39021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39022         LDKChannelDetails this_ptr_conv;
39023         this_ptr_conv.inner = untag_ptr(this_ptr);
39024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39026         this_ptr_conv.is_owned = false;
39027         LDKThirtyTwoBytes val_ref;
39028         CHECK((*env)->GetArrayLength(env, val) == 32);
39029         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39030         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
39031 }
39032
39033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
39034         LDKChannelDetails this_ptr_conv;
39035         this_ptr_conv.inner = untag_ptr(this_ptr);
39036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39038         this_ptr_conv.is_owned = false;
39039         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
39040         int64_t ret_ref = 0;
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39043         return ret_ref;
39044 }
39045
39046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39047         LDKChannelDetails this_ptr_conv;
39048         this_ptr_conv.inner = untag_ptr(this_ptr);
39049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39051         this_ptr_conv.is_owned = false;
39052         LDKChannelCounterparty val_conv;
39053         val_conv.inner = untag_ptr(val);
39054         val_conv.is_owned = ptr_is_owned(val);
39055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39056         val_conv = ChannelCounterparty_clone(&val_conv);
39057         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
39058 }
39059
39060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
39061         LDKChannelDetails this_ptr_conv;
39062         this_ptr_conv.inner = untag_ptr(this_ptr);
39063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39065         this_ptr_conv.is_owned = false;
39066         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
39067         int64_t ret_ref = 0;
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39070         return ret_ref;
39071 }
39072
39073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39074         LDKChannelDetails this_ptr_conv;
39075         this_ptr_conv.inner = untag_ptr(this_ptr);
39076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39078         this_ptr_conv.is_owned = false;
39079         LDKOutPoint val_conv;
39080         val_conv.inner = untag_ptr(val);
39081         val_conv.is_owned = ptr_is_owned(val);
39082         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39083         val_conv = OutPoint_clone(&val_conv);
39084         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
39085 }
39086
39087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
39088         LDKChannelDetails this_ptr_conv;
39089         this_ptr_conv.inner = untag_ptr(this_ptr);
39090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39092         this_ptr_conv.is_owned = false;
39093         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
39094         int64_t ret_ref = 0;
39095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39097         return ret_ref;
39098 }
39099
39100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39101         LDKChannelDetails this_ptr_conv;
39102         this_ptr_conv.inner = untag_ptr(this_ptr);
39103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39105         this_ptr_conv.is_owned = false;
39106         LDKChannelTypeFeatures val_conv;
39107         val_conv.inner = untag_ptr(val);
39108         val_conv.is_owned = ptr_is_owned(val);
39109         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39110         val_conv = ChannelTypeFeatures_clone(&val_conv);
39111         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
39112 }
39113
39114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39115         LDKChannelDetails this_ptr_conv;
39116         this_ptr_conv.inner = untag_ptr(this_ptr);
39117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39119         this_ptr_conv.is_owned = false;
39120         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39121         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
39122         int64_t ret_ref = tag_ptr(ret_copy, true);
39123         return ret_ref;
39124 }
39125
39126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39127         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
39133         CHECK_ACCESS(val_ptr);
39134         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39135         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39136         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
39137 }
39138
39139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39140         LDKChannelDetails this_ptr_conv;
39141         this_ptr_conv.inner = untag_ptr(this_ptr);
39142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39144         this_ptr_conv.is_owned = false;
39145         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39146         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
39147         int64_t ret_ref = tag_ptr(ret_copy, true);
39148         return ret_ref;
39149 }
39150
39151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39152         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
39158         CHECK_ACCESS(val_ptr);
39159         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39160         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39161         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
39162 }
39163
39164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39165         LDKChannelDetails this_ptr_conv;
39166         this_ptr_conv.inner = untag_ptr(this_ptr);
39167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39169         this_ptr_conv.is_owned = false;
39170         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39171         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
39172         int64_t ret_ref = tag_ptr(ret_copy, true);
39173         return ret_ref;
39174 }
39175
39176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39177         LDKChannelDetails this_ptr_conv;
39178         this_ptr_conv.inner = untag_ptr(this_ptr);
39179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39181         this_ptr_conv.is_owned = false;
39182         void* val_ptr = untag_ptr(val);
39183         CHECK_ACCESS(val_ptr);
39184         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39185         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39186         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
39187 }
39188
39189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
39190         LDKChannelDetails this_ptr_conv;
39191         this_ptr_conv.inner = untag_ptr(this_ptr);
39192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39194         this_ptr_conv.is_owned = false;
39195         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
39196         return ret_conv;
39197 }
39198
39199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39200         LDKChannelDetails this_ptr_conv;
39201         this_ptr_conv.inner = untag_ptr(this_ptr);
39202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39204         this_ptr_conv.is_owned = false;
39205         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
39206 }
39207
39208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
39209         LDKChannelDetails this_ptr_conv;
39210         this_ptr_conv.inner = untag_ptr(this_ptr);
39211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39213         this_ptr_conv.is_owned = false;
39214         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39215         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
39216         int64_t ret_ref = tag_ptr(ret_copy, true);
39217         return ret_ref;
39218 }
39219
39220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39221         LDKChannelDetails this_ptr_conv;
39222         this_ptr_conv.inner = untag_ptr(this_ptr);
39223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39225         this_ptr_conv.is_owned = false;
39226         void* val_ptr = untag_ptr(val);
39227         CHECK_ACCESS(val_ptr);
39228         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39229         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39230         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
39231 }
39232
39233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39234         LDKChannelDetails this_ptr_conv;
39235         this_ptr_conv.inner = untag_ptr(this_ptr);
39236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39238         this_ptr_conv.is_owned = false;
39239         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
39240         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
39241         return ret_arr;
39242 }
39243
39244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39245         LDKChannelDetails this_ptr_conv;
39246         this_ptr_conv.inner = untag_ptr(this_ptr);
39247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39249         this_ptr_conv.is_owned = false;
39250         LDKU128 val_ref;
39251         CHECK((*env)->GetArrayLength(env, val) == 16);
39252         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
39253         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
39254 }
39255
39256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
39257         LDKChannelDetails this_ptr_conv;
39258         this_ptr_conv.inner = untag_ptr(this_ptr);
39259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39261         this_ptr_conv.is_owned = false;
39262         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39263         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
39264         int64_t ret_ref = tag_ptr(ret_copy, true);
39265         return ret_ref;
39266 }
39267
39268 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) {
39269         LDKChannelDetails this_ptr_conv;
39270         this_ptr_conv.inner = untag_ptr(this_ptr);
39271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39273         this_ptr_conv.is_owned = false;
39274         void* val_ptr = untag_ptr(val);
39275         CHECK_ACCESS(val_ptr);
39276         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39277         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39278         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
39279 }
39280
39281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39282         LDKChannelDetails this_ptr_conv;
39283         this_ptr_conv.inner = untag_ptr(this_ptr);
39284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39286         this_ptr_conv.is_owned = false;
39287         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
39288         return ret_conv;
39289 }
39290
39291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39292         LDKChannelDetails this_ptr_conv;
39293         this_ptr_conv.inner = untag_ptr(this_ptr);
39294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39296         this_ptr_conv.is_owned = false;
39297         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
39298 }
39299
39300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39301         LDKChannelDetails this_ptr_conv;
39302         this_ptr_conv.inner = untag_ptr(this_ptr);
39303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39305         this_ptr_conv.is_owned = false;
39306         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
39307         return ret_conv;
39308 }
39309
39310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39311         LDKChannelDetails this_ptr_conv;
39312         this_ptr_conv.inner = untag_ptr(this_ptr);
39313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39315         this_ptr_conv.is_owned = false;
39316         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
39317 }
39318
39319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39320         LDKChannelDetails this_ptr_conv;
39321         this_ptr_conv.inner = untag_ptr(this_ptr);
39322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39324         this_ptr_conv.is_owned = false;
39325         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
39326         return ret_conv;
39327 }
39328
39329 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) {
39330         LDKChannelDetails this_ptr_conv;
39331         this_ptr_conv.inner = untag_ptr(this_ptr);
39332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39334         this_ptr_conv.is_owned = false;
39335         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
39336 }
39337
39338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39339         LDKChannelDetails this_ptr_conv;
39340         this_ptr_conv.inner = untag_ptr(this_ptr);
39341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39343         this_ptr_conv.is_owned = false;
39344         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
39345         return ret_conv;
39346 }
39347
39348 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) {
39349         LDKChannelDetails this_ptr_conv;
39350         this_ptr_conv.inner = untag_ptr(this_ptr);
39351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39353         this_ptr_conv.is_owned = false;
39354         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
39355 }
39356
39357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39358         LDKChannelDetails this_ptr_conv;
39359         this_ptr_conv.inner = untag_ptr(this_ptr);
39360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39362         this_ptr_conv.is_owned = false;
39363         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
39364         return ret_conv;
39365 }
39366
39367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39368         LDKChannelDetails this_ptr_conv;
39369         this_ptr_conv.inner = untag_ptr(this_ptr);
39370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39372         this_ptr_conv.is_owned = false;
39373         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
39374 }
39375
39376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
39377         LDKChannelDetails this_ptr_conv;
39378         this_ptr_conv.inner = untag_ptr(this_ptr);
39379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39381         this_ptr_conv.is_owned = false;
39382         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39383         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
39384         int64_t ret_ref = tag_ptr(ret_copy, true);
39385         return ret_ref;
39386 }
39387
39388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39389         LDKChannelDetails this_ptr_conv;
39390         this_ptr_conv.inner = untag_ptr(this_ptr);
39391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39393         this_ptr_conv.is_owned = false;
39394         void* val_ptr = untag_ptr(val);
39395         CHECK_ACCESS(val_ptr);
39396         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39397         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39398         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
39399 }
39400
39401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
39402         LDKChannelDetails this_ptr_conv;
39403         this_ptr_conv.inner = untag_ptr(this_ptr);
39404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39406         this_ptr_conv.is_owned = false;
39407         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39408         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
39409         int64_t ret_ref = tag_ptr(ret_copy, true);
39410         return ret_ref;
39411 }
39412
39413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39414         LDKChannelDetails this_ptr_conv;
39415         this_ptr_conv.inner = untag_ptr(this_ptr);
39416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39418         this_ptr_conv.is_owned = false;
39419         void* val_ptr = untag_ptr(val);
39420         CHECK_ACCESS(val_ptr);
39421         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39422         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39423         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
39424 }
39425
39426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39427         LDKChannelDetails this_ptr_conv;
39428         this_ptr_conv.inner = untag_ptr(this_ptr);
39429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39431         this_ptr_conv.is_owned = false;
39432         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
39433         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
39434         int64_t ret_ref = tag_ptr(ret_copy, true);
39435         return ret_ref;
39436 }
39437
39438 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) {
39439         LDKChannelDetails this_ptr_conv;
39440         this_ptr_conv.inner = untag_ptr(this_ptr);
39441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39443         this_ptr_conv.is_owned = false;
39444         void* val_ptr = untag_ptr(val);
39445         CHECK_ACCESS(val_ptr);
39446         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
39447         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
39448         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
39449 }
39450
39451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
39452         LDKChannelDetails this_ptr_conv;
39453         this_ptr_conv.inner = untag_ptr(this_ptr);
39454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39456         this_ptr_conv.is_owned = false;
39457         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
39458         return ret_conv;
39459 }
39460
39461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39462         LDKChannelDetails this_ptr_conv;
39463         this_ptr_conv.inner = untag_ptr(this_ptr);
39464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39466         this_ptr_conv.is_owned = false;
39467         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
39468 }
39469
39470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
39471         LDKChannelDetails this_ptr_conv;
39472         this_ptr_conv.inner = untag_ptr(this_ptr);
39473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39475         this_ptr_conv.is_owned = false;
39476         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
39477         return ret_conv;
39478 }
39479
39480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39481         LDKChannelDetails this_ptr_conv;
39482         this_ptr_conv.inner = untag_ptr(this_ptr);
39483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39485         this_ptr_conv.is_owned = false;
39486         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
39487 }
39488
39489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
39490         LDKChannelDetails this_ptr_conv;
39491         this_ptr_conv.inner = untag_ptr(this_ptr);
39492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39494         this_ptr_conv.is_owned = false;
39495         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
39496         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
39497         int64_t ret_ref = tag_ptr(ret_copy, true);
39498         return ret_ref;
39499 }
39500
39501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39502         LDKChannelDetails this_ptr_conv;
39503         this_ptr_conv.inner = untag_ptr(this_ptr);
39504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39506         this_ptr_conv.is_owned = false;
39507         void* val_ptr = untag_ptr(val);
39508         CHECK_ACCESS(val_ptr);
39509         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
39510         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
39511         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
39512 }
39513
39514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
39515         LDKChannelDetails this_ptr_conv;
39516         this_ptr_conv.inner = untag_ptr(this_ptr);
39517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39519         this_ptr_conv.is_owned = false;
39520         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
39521         return ret_conv;
39522 }
39523
39524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39525         LDKChannelDetails this_ptr_conv;
39526         this_ptr_conv.inner = untag_ptr(this_ptr);
39527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39529         this_ptr_conv.is_owned = false;
39530         ChannelDetails_set_is_usable(&this_ptr_conv, val);
39531 }
39532
39533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
39534         LDKChannelDetails this_ptr_conv;
39535         this_ptr_conv.inner = untag_ptr(this_ptr);
39536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39538         this_ptr_conv.is_owned = false;
39539         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
39540         return ret_conv;
39541 }
39542
39543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39544         LDKChannelDetails this_ptr_conv;
39545         this_ptr_conv.inner = untag_ptr(this_ptr);
39546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39548         this_ptr_conv.is_owned = false;
39549         ChannelDetails_set_is_public(&this_ptr_conv, val);
39550 }
39551
39552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39553         LDKChannelDetails this_ptr_conv;
39554         this_ptr_conv.inner = untag_ptr(this_ptr);
39555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39557         this_ptr_conv.is_owned = false;
39558         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39559         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
39560         int64_t ret_ref = tag_ptr(ret_copy, true);
39561         return ret_ref;
39562 }
39563
39564 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) {
39565         LDKChannelDetails this_ptr_conv;
39566         this_ptr_conv.inner = untag_ptr(this_ptr);
39567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39569         this_ptr_conv.is_owned = false;
39570         void* val_ptr = untag_ptr(val);
39571         CHECK_ACCESS(val_ptr);
39572         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39573         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39574         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
39575 }
39576
39577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39578         LDKChannelDetails this_ptr_conv;
39579         this_ptr_conv.inner = untag_ptr(this_ptr);
39580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39582         this_ptr_conv.is_owned = false;
39583         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39584         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
39585         int64_t ret_ref = tag_ptr(ret_copy, true);
39586         return ret_ref;
39587 }
39588
39589 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) {
39590         LDKChannelDetails this_ptr_conv;
39591         this_ptr_conv.inner = untag_ptr(this_ptr);
39592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39594         this_ptr_conv.is_owned = false;
39595         void* val_ptr = untag_ptr(val);
39596         CHECK_ACCESS(val_ptr);
39597         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39598         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39599         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
39600 }
39601
39602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39603         LDKChannelDetails this_ptr_conv;
39604         this_ptr_conv.inner = untag_ptr(this_ptr);
39605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39607         this_ptr_conv.is_owned = false;
39608         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
39609         int64_t ret_ref = 0;
39610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39612         return ret_ref;
39613 }
39614
39615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39616         LDKChannelDetails this_ptr_conv;
39617         this_ptr_conv.inner = untag_ptr(this_ptr);
39618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39620         this_ptr_conv.is_owned = false;
39621         LDKChannelConfig val_conv;
39622         val_conv.inner = untag_ptr(val);
39623         val_conv.is_owned = ptr_is_owned(val);
39624         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39625         val_conv = ChannelConfig_clone(&val_conv);
39626         ChannelDetails_set_config(&this_ptr_conv, val_conv);
39627 }
39628
39629 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) {
39630         LDKThirtyTwoBytes channel_id_arg_ref;
39631         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
39632         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
39633         LDKChannelCounterparty counterparty_arg_conv;
39634         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
39635         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
39637         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
39638         LDKOutPoint funding_txo_arg_conv;
39639         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
39640         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
39641         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
39642         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
39643         LDKChannelTypeFeatures channel_type_arg_conv;
39644         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
39645         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
39646         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
39647         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
39648         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
39649         CHECK_ACCESS(short_channel_id_arg_ptr);
39650         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
39651         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
39652         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
39653         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
39654         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
39655         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
39656         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
39657         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
39658         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
39659         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
39660         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
39661         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
39662         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
39663         LDKU128 user_channel_id_arg_ref;
39664         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
39665         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
39666         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
39667         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
39668         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
39669         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
39670         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
39671         CHECK_ACCESS(confirmations_required_arg_ptr);
39672         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
39673         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
39674         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
39675         CHECK_ACCESS(confirmations_arg_ptr);
39676         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
39677         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
39678         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
39679         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
39680         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
39681         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
39682         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
39683         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
39684         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
39685         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
39686         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
39687         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
39688         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
39689         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
39690         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
39691         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
39692         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
39693         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
39694         LDKChannelConfig config_arg_conv;
39695         config_arg_conv.inner = untag_ptr(config_arg);
39696         config_arg_conv.is_owned = ptr_is_owned(config_arg);
39697         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
39698         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
39699         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);
39700         int64_t ret_ref = 0;
39701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39703         return ret_ref;
39704 }
39705
39706 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
39707         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
39708         int64_t ret_ref = 0;
39709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39711         return ret_ref;
39712 }
39713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39714         LDKChannelDetails arg_conv;
39715         arg_conv.inner = untag_ptr(arg);
39716         arg_conv.is_owned = ptr_is_owned(arg);
39717         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39718         arg_conv.is_owned = false;
39719         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
39720         return ret_conv;
39721 }
39722
39723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39724         LDKChannelDetails orig_conv;
39725         orig_conv.inner = untag_ptr(orig);
39726         orig_conv.is_owned = ptr_is_owned(orig);
39727         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39728         orig_conv.is_owned = false;
39729         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
39730         int64_t ret_ref = 0;
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39733         return ret_ref;
39734 }
39735
39736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
39737         LDKChannelDetails this_arg_conv;
39738         this_arg_conv.inner = untag_ptr(this_arg);
39739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39741         this_arg_conv.is_owned = false;
39742         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39743         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
39744         int64_t ret_ref = tag_ptr(ret_copy, true);
39745         return ret_ref;
39746 }
39747
39748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
39749         LDKChannelDetails this_arg_conv;
39750         this_arg_conv.inner = untag_ptr(this_arg);
39751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39753         this_arg_conv.is_owned = false;
39754         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39755         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
39756         int64_t ret_ref = tag_ptr(ret_copy, true);
39757         return ret_ref;
39758 }
39759
39760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39761         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
39762         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
39763         return ret_conv;
39764 }
39765
39766 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
39767         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
39768         return ret_conv;
39769 }
39770
39771 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
39772         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
39773         return ret_conv;
39774 }
39775
39776 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
39777         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
39778         return ret_conv;
39779 }
39780
39781 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
39782         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
39783         return ret_conv;
39784 }
39785
39786 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
39787         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
39788         return ret_conv;
39789 }
39790
39791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39792         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
39793         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
39794         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
39795         return ret_conv;
39796 }
39797
39798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39799         if (!ptr_is_owned(this_ptr)) return;
39800         void* this_ptr_ptr = untag_ptr(this_ptr);
39801         CHECK_ACCESS(this_ptr_ptr);
39802         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
39803         FREE(untag_ptr(this_ptr));
39804         RecentPaymentDetails_free(this_ptr_conv);
39805 }
39806
39807 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
39808         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39809         *ret_copy = RecentPaymentDetails_clone(arg);
39810         int64_t ret_ref = tag_ptr(ret_copy, true);
39811         return ret_ref;
39812 }
39813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39814         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
39815         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
39816         return ret_conv;
39817 }
39818
39819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39820         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
39821         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39822         *ret_copy = RecentPaymentDetails_clone(orig_conv);
39823         int64_t ret_ref = tag_ptr(ret_copy, true);
39824         return ret_ref;
39825 }
39826
39827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
39828         LDKThirtyTwoBytes payment_id_ref;
39829         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39830         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39831         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39832         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
39833         int64_t ret_ref = tag_ptr(ret_copy, true);
39834         return ret_ref;
39835 }
39836
39837 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) {
39838         LDKThirtyTwoBytes payment_id_ref;
39839         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39840         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39841         LDKThirtyTwoBytes payment_hash_ref;
39842         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
39843         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
39844         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39845         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
39846         int64_t ret_ref = tag_ptr(ret_copy, true);
39847         return ret_ref;
39848 }
39849
39850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
39851         LDKThirtyTwoBytes payment_id_ref;
39852         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39853         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39854         void* payment_hash_ptr = untag_ptr(payment_hash);
39855         CHECK_ACCESS(payment_hash_ptr);
39856         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
39857         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
39858         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39859         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
39860         int64_t ret_ref = tag_ptr(ret_copy, true);
39861         return ret_ref;
39862 }
39863
39864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
39865         LDKThirtyTwoBytes payment_id_ref;
39866         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39867         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39868         LDKThirtyTwoBytes payment_hash_ref;
39869         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
39870         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
39871         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39872         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
39873         int64_t ret_ref = tag_ptr(ret_copy, true);
39874         return ret_ref;
39875 }
39876
39877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39878         LDKPhantomRouteHints this_obj_conv;
39879         this_obj_conv.inner = untag_ptr(this_obj);
39880         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39882         PhantomRouteHints_free(this_obj_conv);
39883 }
39884
39885 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39886         LDKPhantomRouteHints this_ptr_conv;
39887         this_ptr_conv.inner = untag_ptr(this_ptr);
39888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39890         this_ptr_conv.is_owned = false;
39891         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
39892         int64_tArray ret_arr = NULL;
39893         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
39894         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
39895         for (size_t q = 0; q < ret_var.datalen; q++) {
39896                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
39897                 int64_t ret_conv_16_ref = 0;
39898                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
39899                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
39900                 ret_arr_ptr[q] = ret_conv_16_ref;
39901         }
39902         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
39903         FREE(ret_var.data);
39904         return ret_arr;
39905 }
39906
39907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
39908         LDKPhantomRouteHints this_ptr_conv;
39909         this_ptr_conv.inner = untag_ptr(this_ptr);
39910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39912         this_ptr_conv.is_owned = false;
39913         LDKCVec_ChannelDetailsZ val_constr;
39914         val_constr.datalen = (*env)->GetArrayLength(env, val);
39915         if (val_constr.datalen > 0)
39916                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
39917         else
39918                 val_constr.data = NULL;
39919         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
39920         for (size_t q = 0; q < val_constr.datalen; q++) {
39921                 int64_t val_conv_16 = val_vals[q];
39922                 LDKChannelDetails val_conv_16_conv;
39923                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
39924                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
39925                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
39926                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
39927                 val_constr.data[q] = val_conv_16_conv;
39928         }
39929         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
39930         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
39931 }
39932
39933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
39934         LDKPhantomRouteHints this_ptr_conv;
39935         this_ptr_conv.inner = untag_ptr(this_ptr);
39936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39938         this_ptr_conv.is_owned = false;
39939         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
39940         return ret_conv;
39941 }
39942
39943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39944         LDKPhantomRouteHints this_ptr_conv;
39945         this_ptr_conv.inner = untag_ptr(this_ptr);
39946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39948         this_ptr_conv.is_owned = false;
39949         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
39950 }
39951
39952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39953         LDKPhantomRouteHints this_ptr_conv;
39954         this_ptr_conv.inner = untag_ptr(this_ptr);
39955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39957         this_ptr_conv.is_owned = false;
39958         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39959         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
39960         return ret_arr;
39961 }
39962
39963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39964         LDKPhantomRouteHints this_ptr_conv;
39965         this_ptr_conv.inner = untag_ptr(this_ptr);
39966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39968         this_ptr_conv.is_owned = false;
39969         LDKPublicKey val_ref;
39970         CHECK((*env)->GetArrayLength(env, val) == 33);
39971         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39972         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
39973 }
39974
39975 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) {
39976         LDKCVec_ChannelDetailsZ channels_arg_constr;
39977         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
39978         if (channels_arg_constr.datalen > 0)
39979                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
39980         else
39981                 channels_arg_constr.data = NULL;
39982         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
39983         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
39984                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
39985                 LDKChannelDetails channels_arg_conv_16_conv;
39986                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
39987                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
39988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
39989                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
39990                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
39991         }
39992         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
39993         LDKPublicKey real_node_pubkey_arg_ref;
39994         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
39995         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
39996         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
39997         int64_t ret_ref = 0;
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40000         return ret_ref;
40001 }
40002
40003 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
40004         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
40005         int64_t ret_ref = 0;
40006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40008         return ret_ref;
40009 }
40010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40011         LDKPhantomRouteHints arg_conv;
40012         arg_conv.inner = untag_ptr(arg);
40013         arg_conv.is_owned = ptr_is_owned(arg);
40014         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40015         arg_conv.is_owned = false;
40016         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
40017         return ret_conv;
40018 }
40019
40020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40021         LDKPhantomRouteHints orig_conv;
40022         orig_conv.inner = untag_ptr(orig);
40023         orig_conv.is_owned = ptr_is_owned(orig);
40024         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40025         orig_conv.is_owned = false;
40026         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
40027         int64_t ret_ref = 0;
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40030         return ret_ref;
40031 }
40032
40033 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) {
40034         void* fee_est_ptr = untag_ptr(fee_est);
40035         CHECK_ACCESS(fee_est_ptr);
40036         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
40037         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
40038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40039                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
40040         }
40041         void* chain_monitor_ptr = untag_ptr(chain_monitor);
40042         CHECK_ACCESS(chain_monitor_ptr);
40043         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
40044         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
40045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40046                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
40047         }
40048         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
40049         CHECK_ACCESS(tx_broadcaster_ptr);
40050         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
40051         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40052                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40053                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
40054         }
40055         void* router_ptr = untag_ptr(router);
40056         CHECK_ACCESS(router_ptr);
40057         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
40058         if (router_conv.free == LDKRouter_JCalls_free) {
40059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40060                 LDKRouter_JCalls_cloned(&router_conv);
40061         }
40062         void* logger_ptr = untag_ptr(logger);
40063         CHECK_ACCESS(logger_ptr);
40064         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40065         if (logger_conv.free == LDKLogger_JCalls_free) {
40066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40067                 LDKLogger_JCalls_cloned(&logger_conv);
40068         }
40069         void* entropy_source_ptr = untag_ptr(entropy_source);
40070         CHECK_ACCESS(entropy_source_ptr);
40071         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
40072         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
40073                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40074                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
40075         }
40076         void* node_signer_ptr = untag_ptr(node_signer);
40077         CHECK_ACCESS(node_signer_ptr);
40078         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
40079         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
40080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40081                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
40082         }
40083         void* signer_provider_ptr = untag_ptr(signer_provider);
40084         CHECK_ACCESS(signer_provider_ptr);
40085         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
40086         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
40087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40088                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
40089         }
40090         LDKUserConfig config_conv;
40091         config_conv.inner = untag_ptr(config);
40092         config_conv.is_owned = ptr_is_owned(config);
40093         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
40094         config_conv = UserConfig_clone(&config_conv);
40095         LDKChainParameters params_conv;
40096         params_conv.inner = untag_ptr(params);
40097         params_conv.is_owned = ptr_is_owned(params);
40098         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
40099         params_conv = ChainParameters_clone(&params_conv);
40100         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);
40101         int64_t ret_ref = 0;
40102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40104         return ret_ref;
40105 }
40106
40107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
40108         LDKChannelManager this_arg_conv;
40109         this_arg_conv.inner = untag_ptr(this_arg);
40110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40112         this_arg_conv.is_owned = false;
40113         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
40114         int64_t ret_ref = 0;
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40117         return ret_ref;
40118 }
40119
40120 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 override_config) {
40121         LDKChannelManager this_arg_conv;
40122         this_arg_conv.inner = untag_ptr(this_arg);
40123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40125         this_arg_conv.is_owned = false;
40126         LDKPublicKey their_network_key_ref;
40127         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
40128         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
40129         LDKU128 user_channel_id_ref;
40130         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40131         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40132         LDKUserConfig override_config_conv;
40133         override_config_conv.inner = untag_ptr(override_config);
40134         override_config_conv.is_owned = ptr_is_owned(override_config);
40135         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
40136         override_config_conv = UserConfig_clone(&override_config_conv);
40137         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
40138         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
40139         return tag_ptr(ret_conv, true);
40140 }
40141
40142 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40143         LDKChannelManager this_arg_conv;
40144         this_arg_conv.inner = untag_ptr(this_arg);
40145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40147         this_arg_conv.is_owned = false;
40148         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
40149         int64_tArray ret_arr = NULL;
40150         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40151         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40152         for (size_t q = 0; q < ret_var.datalen; q++) {
40153                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40154                 int64_t ret_conv_16_ref = 0;
40155                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40156                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40157                 ret_arr_ptr[q] = ret_conv_16_ref;
40158         }
40159         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40160         FREE(ret_var.data);
40161         return ret_arr;
40162 }
40163
40164 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40165         LDKChannelManager this_arg_conv;
40166         this_arg_conv.inner = untag_ptr(this_arg);
40167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40169         this_arg_conv.is_owned = false;
40170         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
40171         int64_tArray ret_arr = NULL;
40172         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40173         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40174         for (size_t q = 0; q < ret_var.datalen; q++) {
40175                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40176                 int64_t ret_conv_16_ref = 0;
40177                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40178                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40179                 ret_arr_ptr[q] = ret_conv_16_ref;
40180         }
40181         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40182         FREE(ret_var.data);
40183         return ret_arr;
40184 }
40185
40186 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) {
40187         LDKChannelManager this_arg_conv;
40188         this_arg_conv.inner = untag_ptr(this_arg);
40189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40191         this_arg_conv.is_owned = false;
40192         LDKPublicKey counterparty_node_id_ref;
40193         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40194         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40195         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
40196         int64_tArray ret_arr = NULL;
40197         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40198         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40199         for (size_t q = 0; q < ret_var.datalen; q++) {
40200                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40201                 int64_t ret_conv_16_ref = 0;
40202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40203                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40204                 ret_arr_ptr[q] = ret_conv_16_ref;
40205         }
40206         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40207         FREE(ret_var.data);
40208         return ret_arr;
40209 }
40210
40211 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
40212         LDKChannelManager this_arg_conv;
40213         this_arg_conv.inner = untag_ptr(this_arg);
40214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40216         this_arg_conv.is_owned = false;
40217         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
40218         int64_tArray ret_arr = NULL;
40219         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40220         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40221         for (size_t w = 0; w < ret_var.datalen; w++) {
40222                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40223                 *ret_conv_22_copy = ret_var.data[w];
40224                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
40225                 ret_arr_ptr[w] = ret_conv_22_ref;
40226         }
40227         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40228         FREE(ret_var.data);
40229         return ret_arr;
40230 }
40231
40232 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) {
40233         LDKChannelManager this_arg_conv;
40234         this_arg_conv.inner = untag_ptr(this_arg);
40235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40237         this_arg_conv.is_owned = false;
40238         uint8_t channel_id_arr[32];
40239         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40240         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40241         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40242         LDKPublicKey counterparty_node_id_ref;
40243         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40244         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40245         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40246         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40247         return tag_ptr(ret_conv, true);
40248 }
40249
40250 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) {
40251         LDKChannelManager this_arg_conv;
40252         this_arg_conv.inner = untag_ptr(this_arg);
40253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40255         this_arg_conv.is_owned = false;
40256         uint8_t channel_id_arr[32];
40257         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40258         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40259         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40260         LDKPublicKey counterparty_node_id_ref;
40261         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40262         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40263         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
40264         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
40265         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
40266         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
40267         LDKShutdownScript shutdown_script_conv;
40268         shutdown_script_conv.inner = untag_ptr(shutdown_script);
40269         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
40270         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
40271         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
40272         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40273         *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);
40274         return tag_ptr(ret_conv, true);
40275 }
40276
40277 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) {
40278         LDKChannelManager this_arg_conv;
40279         this_arg_conv.inner = untag_ptr(this_arg);
40280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40282         this_arg_conv.is_owned = false;
40283         uint8_t channel_id_arr[32];
40284         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40285         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40286         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40287         LDKPublicKey counterparty_node_id_ref;
40288         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40289         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40290         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40291         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40292         return tag_ptr(ret_conv, true);
40293 }
40294
40295 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) {
40296         LDKChannelManager this_arg_conv;
40297         this_arg_conv.inner = untag_ptr(this_arg);
40298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40300         this_arg_conv.is_owned = false;
40301         uint8_t channel_id_arr[32];
40302         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40303         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40304         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40305         LDKPublicKey counterparty_node_id_ref;
40306         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40307         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40308         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40309         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40310         return tag_ptr(ret_conv, true);
40311 }
40312
40313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40314         LDKChannelManager this_arg_conv;
40315         this_arg_conv.inner = untag_ptr(this_arg);
40316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40318         this_arg_conv.is_owned = false;
40319         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
40320 }
40321
40322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40323         LDKChannelManager this_arg_conv;
40324         this_arg_conv.inner = untag_ptr(this_arg);
40325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40327         this_arg_conv.is_owned = false;
40328         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
40329 }
40330
40331 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) {
40332         LDKChannelManager this_arg_conv;
40333         this_arg_conv.inner = untag_ptr(this_arg);
40334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40336         this_arg_conv.is_owned = false;
40337         LDKRoute route_conv;
40338         route_conv.inner = untag_ptr(route);
40339         route_conv.is_owned = ptr_is_owned(route);
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40341         route_conv.is_owned = false;
40342         LDKThirtyTwoBytes payment_hash_ref;
40343         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40344         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40345         LDKRecipientOnionFields recipient_onion_conv;
40346         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40347         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40348         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40349         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40350         LDKThirtyTwoBytes payment_id_ref;
40351         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40352         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40353         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
40354         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
40355         return tag_ptr(ret_conv, true);
40356 }
40357
40358 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) {
40359         LDKChannelManager this_arg_conv;
40360         this_arg_conv.inner = untag_ptr(this_arg);
40361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40363         this_arg_conv.is_owned = false;
40364         LDKThirtyTwoBytes payment_hash_ref;
40365         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40366         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40367         LDKRecipientOnionFields recipient_onion_conv;
40368         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40369         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40370         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40371         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40372         LDKThirtyTwoBytes payment_id_ref;
40373         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40374         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40375         LDKRouteParameters route_params_conv;
40376         route_params_conv.inner = untag_ptr(route_params);
40377         route_params_conv.is_owned = ptr_is_owned(route_params);
40378         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40379         route_params_conv = RouteParameters_clone(&route_params_conv);
40380         void* retry_strategy_ptr = untag_ptr(retry_strategy);
40381         CHECK_ACCESS(retry_strategy_ptr);
40382         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
40383         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
40384         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
40385         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
40386         return tag_ptr(ret_conv, true);
40387 }
40388
40389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
40390         LDKChannelManager this_arg_conv;
40391         this_arg_conv.inner = untag_ptr(this_arg);
40392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40394         this_arg_conv.is_owned = false;
40395         LDKThirtyTwoBytes payment_id_ref;
40396         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40397         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40398         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
40399 }
40400
40401 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) {
40402         LDKChannelManager this_arg_conv;
40403         this_arg_conv.inner = untag_ptr(this_arg);
40404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40406         this_arg_conv.is_owned = false;
40407         LDKRoute route_conv;
40408         route_conv.inner = untag_ptr(route);
40409         route_conv.is_owned = ptr_is_owned(route);
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40411         route_conv.is_owned = false;
40412         void* payment_preimage_ptr = untag_ptr(payment_preimage);
40413         CHECK_ACCESS(payment_preimage_ptr);
40414         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
40415         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
40416         LDKRecipientOnionFields recipient_onion_conv;
40417         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40418         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40419         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40420         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40421         LDKThirtyTwoBytes payment_id_ref;
40422         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40423         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40424         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
40425         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
40426         return tag_ptr(ret_conv, true);
40427 }
40428
40429 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) {
40430         LDKChannelManager this_arg_conv;
40431         this_arg_conv.inner = untag_ptr(this_arg);
40432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40434         this_arg_conv.is_owned = false;
40435         void* payment_preimage_ptr = untag_ptr(payment_preimage);
40436         CHECK_ACCESS(payment_preimage_ptr);
40437         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
40438         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
40439         LDKRecipientOnionFields recipient_onion_conv;
40440         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40441         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40442         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40443         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40444         LDKThirtyTwoBytes payment_id_ref;
40445         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40446         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40447         LDKRouteParameters route_params_conv;
40448         route_params_conv.inner = untag_ptr(route_params);
40449         route_params_conv.is_owned = ptr_is_owned(route_params);
40450         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40451         route_params_conv = RouteParameters_clone(&route_params_conv);
40452         void* retry_strategy_ptr = untag_ptr(retry_strategy);
40453         CHECK_ACCESS(retry_strategy_ptr);
40454         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
40455         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
40456         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
40457         *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);
40458         return tag_ptr(ret_conv, true);
40459 }
40460
40461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
40462         LDKChannelManager this_arg_conv;
40463         this_arg_conv.inner = untag_ptr(this_arg);
40464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40466         this_arg_conv.is_owned = false;
40467         LDKPath path_conv;
40468         path_conv.inner = untag_ptr(path);
40469         path_conv.is_owned = ptr_is_owned(path);
40470         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
40471         path_conv = Path_clone(&path_conv);
40472         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
40473         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
40474         return tag_ptr(ret_conv, true);
40475 }
40476
40477 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) {
40478         LDKChannelManager this_arg_conv;
40479         this_arg_conv.inner = untag_ptr(this_arg);
40480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40482         this_arg_conv.is_owned = false;
40483         LDKPublicKey node_id_ref;
40484         CHECK((*env)->GetArrayLength(env, node_id) == 33);
40485         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
40486         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
40487         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
40488         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
40489         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
40490         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
40491         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
40492         return tag_ptr(ret_conv, true);
40493 }
40494
40495 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) {
40496         LDKChannelManager this_arg_conv;
40497         this_arg_conv.inner = untag_ptr(this_arg);
40498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40500         this_arg_conv.is_owned = false;
40501         LDKRouteParameters route_params_conv;
40502         route_params_conv.inner = untag_ptr(route_params);
40503         route_params_conv.is_owned = ptr_is_owned(route_params);
40504         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40505         route_params_conv = RouteParameters_clone(&route_params_conv);
40506         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
40507         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
40508         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
40509         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
40510         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
40511         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
40512         return tag_ptr(ret_conv, true);
40513 }
40514
40515 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) {
40516         LDKChannelManager this_arg_conv;
40517         this_arg_conv.inner = untag_ptr(this_arg);
40518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40520         this_arg_conv.is_owned = false;
40521         uint8_t temporary_channel_id_arr[32];
40522         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
40523         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
40524         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
40525         LDKPublicKey counterparty_node_id_ref;
40526         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40527         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40528         LDKTransaction funding_transaction_ref;
40529         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
40530         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
40531         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
40532         funding_transaction_ref.data_is_owned = true;
40533         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40534         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
40535         return tag_ptr(ret_conv, true);
40536 }
40537
40538 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) {
40539         LDKChannelManager this_arg_conv;
40540         this_arg_conv.inner = untag_ptr(this_arg);
40541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40543         this_arg_conv.is_owned = false;
40544         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
40545         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
40546         if (temporary_channels_constr.datalen > 0)
40547                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
40548         else
40549                 temporary_channels_constr.data = NULL;
40550         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
40551         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
40552                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
40553                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
40554                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
40555                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
40556                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
40557                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
40558         }
40559         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
40560         LDKTransaction funding_transaction_ref;
40561         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
40562         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
40563         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
40564         funding_transaction_ref.data_is_owned = true;
40565         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40566         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
40567         return tag_ptr(ret_conv, true);
40568 }
40569
40570 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) {
40571         LDKChannelManager this_arg_conv;
40572         this_arg_conv.inner = untag_ptr(this_arg);
40573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40575         this_arg_conv.is_owned = false;
40576         LDKPublicKey counterparty_node_id_ref;
40577         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40578         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40579         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
40580         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
40581         if (channel_ids_constr.datalen > 0)
40582                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
40583         else
40584                 channel_ids_constr.data = NULL;
40585         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
40586                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
40587                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
40588                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
40589                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
40590                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
40591         }
40592         LDKChannelConfigUpdate config_update_conv;
40593         config_update_conv.inner = untag_ptr(config_update);
40594         config_update_conv.is_owned = ptr_is_owned(config_update);
40595         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
40596         config_update_conv.is_owned = false;
40597         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40598         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
40599         return tag_ptr(ret_conv, true);
40600 }
40601
40602 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) {
40603         LDKChannelManager this_arg_conv;
40604         this_arg_conv.inner = untag_ptr(this_arg);
40605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40607         this_arg_conv.is_owned = false;
40608         LDKPublicKey counterparty_node_id_ref;
40609         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40610         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40611         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
40612         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
40613         if (channel_ids_constr.datalen > 0)
40614                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
40615         else
40616                 channel_ids_constr.data = NULL;
40617         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
40618                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
40619                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
40620                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
40621                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
40622                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
40623         }
40624         LDKChannelConfig config_conv;
40625         config_conv.inner = untag_ptr(config);
40626         config_conv.is_owned = ptr_is_owned(config);
40627         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
40628         config_conv.is_owned = false;
40629         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40630         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
40631         return tag_ptr(ret_conv, true);
40632 }
40633
40634 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) {
40635         LDKChannelManager this_arg_conv;
40636         this_arg_conv.inner = untag_ptr(this_arg);
40637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40639         this_arg_conv.is_owned = false;
40640         LDKThirtyTwoBytes intercept_id_ref;
40641         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
40642         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
40643         uint8_t next_hop_channel_id_arr[32];
40644         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
40645         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
40646         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
40647         LDKPublicKey next_node_id_ref;
40648         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
40649         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
40650         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40651         *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);
40652         return tag_ptr(ret_conv, true);
40653 }
40654
40655 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) {
40656         LDKChannelManager this_arg_conv;
40657         this_arg_conv.inner = untag_ptr(this_arg);
40658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40660         this_arg_conv.is_owned = false;
40661         LDKThirtyTwoBytes intercept_id_ref;
40662         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
40663         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
40664         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40665         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
40666         return tag_ptr(ret_conv, true);
40667 }
40668
40669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
40670         LDKChannelManager this_arg_conv;
40671         this_arg_conv.inner = untag_ptr(this_arg);
40672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40674         this_arg_conv.is_owned = false;
40675         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
40676 }
40677
40678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
40679         LDKChannelManager this_arg_conv;
40680         this_arg_conv.inner = untag_ptr(this_arg);
40681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40683         this_arg_conv.is_owned = false;
40684         ChannelManager_timer_tick_occurred(&this_arg_conv);
40685 }
40686
40687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
40688         LDKChannelManager this_arg_conv;
40689         this_arg_conv.inner = untag_ptr(this_arg);
40690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40692         this_arg_conv.is_owned = false;
40693         uint8_t payment_hash_arr[32];
40694         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40695         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
40696         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
40697         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
40698 }
40699
40700 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) {
40701         LDKChannelManager this_arg_conv;
40702         this_arg_conv.inner = untag_ptr(this_arg);
40703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40705         this_arg_conv.is_owned = false;
40706         uint8_t payment_hash_arr[32];
40707         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40708         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
40709         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
40710         void* failure_code_ptr = untag_ptr(failure_code);
40711         CHECK_ACCESS(failure_code_ptr);
40712         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
40713         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
40714         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
40715 }
40716
40717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
40718         LDKChannelManager this_arg_conv;
40719         this_arg_conv.inner = untag_ptr(this_arg);
40720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40722         this_arg_conv.is_owned = false;
40723         LDKThirtyTwoBytes payment_preimage_ref;
40724         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
40725         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
40726         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
40727 }
40728
40729 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) {
40730         LDKChannelManager this_arg_conv;
40731         this_arg_conv.inner = untag_ptr(this_arg);
40732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40734         this_arg_conv.is_owned = false;
40735         LDKThirtyTwoBytes payment_preimage_ref;
40736         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
40737         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
40738         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
40739 }
40740
40741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
40742         LDKChannelManager this_arg_conv;
40743         this_arg_conv.inner = untag_ptr(this_arg);
40744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40746         this_arg_conv.is_owned = false;
40747         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40748         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
40749         return ret_arr;
40750 }
40751
40752 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) {
40753         LDKChannelManager this_arg_conv;
40754         this_arg_conv.inner = untag_ptr(this_arg);
40755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40757         this_arg_conv.is_owned = false;
40758         uint8_t temporary_channel_id_arr[32];
40759         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
40760         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
40761         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
40762         LDKPublicKey counterparty_node_id_ref;
40763         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40764         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40765         LDKU128 user_channel_id_ref;
40766         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40767         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40768         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40769         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
40770         return tag_ptr(ret_conv, true);
40771 }
40772
40773 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) {
40774         LDKChannelManager this_arg_conv;
40775         this_arg_conv.inner = untag_ptr(this_arg);
40776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40778         this_arg_conv.is_owned = false;
40779         uint8_t temporary_channel_id_arr[32];
40780         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
40781         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
40782         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
40783         LDKPublicKey counterparty_node_id_ref;
40784         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40785         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40786         LDKU128 user_channel_id_ref;
40787         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40788         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40789         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40790         *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);
40791         return tag_ptr(ret_conv, true);
40792 }
40793
40794 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) {
40795         LDKChannelManager this_arg_conv;
40796         this_arg_conv.inner = untag_ptr(this_arg);
40797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40799         this_arg_conv.is_owned = false;
40800         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40801         CHECK_ACCESS(min_value_msat_ptr);
40802         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40803         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40804         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40805         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40806         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40807         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40808         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
40809         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
40810         return tag_ptr(ret_conv, true);
40811 }
40812
40813 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) {
40814         LDKChannelManager this_arg_conv;
40815         this_arg_conv.inner = untag_ptr(this_arg);
40816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40818         this_arg_conv.is_owned = false;
40819         LDKThirtyTwoBytes payment_hash_ref;
40820         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40821         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40822         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40823         CHECK_ACCESS(min_value_msat_ptr);
40824         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40825         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40826         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
40827         CHECK_ACCESS(min_final_cltv_expiry_ptr);
40828         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
40829         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
40830         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
40831         *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);
40832         return tag_ptr(ret_conv, true);
40833 }
40834
40835 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) {
40836         LDKChannelManager this_arg_conv;
40837         this_arg_conv.inner = untag_ptr(this_arg);
40838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40840         this_arg_conv.is_owned = false;
40841         LDKThirtyTwoBytes payment_hash_ref;
40842         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40843         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40844         LDKThirtyTwoBytes payment_secret_ref;
40845         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
40846         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
40847         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
40848         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
40849         return tag_ptr(ret_conv, true);
40850 }
40851
40852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40853         LDKChannelManager this_arg_conv;
40854         this_arg_conv.inner = untag_ptr(this_arg);
40855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40857         this_arg_conv.is_owned = false;
40858         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
40859         return ret_conv;
40860 }
40861
40862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
40863         LDKChannelManager this_arg_conv;
40864         this_arg_conv.inner = untag_ptr(this_arg);
40865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40867         this_arg_conv.is_owned = false;
40868         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
40869         int64_t ret_ref = 0;
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40872         return ret_ref;
40873 }
40874
40875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40876         LDKChannelManager this_arg_conv;
40877         this_arg_conv.inner = untag_ptr(this_arg);
40878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40880         this_arg_conv.is_owned = false;
40881         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
40882         return ret_conv;
40883 }
40884
40885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
40886         LDKChannelManager 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         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
40892         int64_t ret_ref = 0;
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40895         return ret_ref;
40896 }
40897
40898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
40899         LDKChannelManager this_arg_conv;
40900         this_arg_conv.inner = untag_ptr(this_arg);
40901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40903         this_arg_conv.is_owned = false;
40904         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
40905         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
40906         return tag_ptr(ret_ret, true);
40907 }
40908
40909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
40910         LDKChannelManager this_arg_conv;
40911         this_arg_conv.inner = untag_ptr(this_arg);
40912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40914         this_arg_conv.is_owned = false;
40915         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
40916         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
40917         return tag_ptr(ret_ret, true);
40918 }
40919
40920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
40921         LDKChannelManager this_arg_conv;
40922         this_arg_conv.inner = untag_ptr(this_arg);
40923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40925         this_arg_conv.is_owned = false;
40926         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
40927         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
40928         return tag_ptr(ret_ret, true);
40929 }
40930
40931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
40932         LDKChannelManager this_arg_conv;
40933         this_arg_conv.inner = untag_ptr(this_arg);
40934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40936         this_arg_conv.is_owned = false;
40937         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
40938         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
40939         return tag_ptr(ret_ret, true);
40940 }
40941
40942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
40943         LDKChannelManager this_arg_conv;
40944         this_arg_conv.inner = untag_ptr(this_arg);
40945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40947         this_arg_conv.is_owned = false;
40948         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
40949         int64_t ret_ref = 0;
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40952         return ret_ref;
40953 }
40954
40955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
40956         LDKChannelManager this_arg_conv;
40957         this_arg_conv.inner = untag_ptr(this_arg);
40958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40960         this_arg_conv.is_owned = false;
40961         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
40962         return ret_conv;
40963 }
40964
40965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
40966         LDKChannelManager this_arg_conv;
40967         this_arg_conv.inner = untag_ptr(this_arg);
40968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40970         this_arg_conv.is_owned = false;
40971         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
40972         int64_t ret_ref = 0;
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40975         return ret_ref;
40976 }
40977
40978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
40979         LDKChannelManager this_arg_conv;
40980         this_arg_conv.inner = untag_ptr(this_arg);
40981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40983         this_arg_conv.is_owned = false;
40984         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
40985         int64_t ret_ref = 0;
40986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40988         return ret_ref;
40989 }
40990
40991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
40992         LDKChannelManager this_arg_conv;
40993         this_arg_conv.inner = untag_ptr(this_arg);
40994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40996         this_arg_conv.is_owned = false;
40997         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
40998         int64_t ret_ref = 0;
40999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41001         return ret_ref;
41002 }
41003
41004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41005         LDKChannelManager this_arg_conv;
41006         this_arg_conv.inner = untag_ptr(this_arg);
41007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41009         this_arg_conv.is_owned = false;
41010         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
41011         int64_t ret_ref = 0;
41012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41014         return ret_ref;
41015 }
41016
41017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41018         LDKChannelManager this_arg_conv;
41019         this_arg_conv.inner = untag_ptr(this_arg);
41020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41022         this_arg_conv.is_owned = false;
41023         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
41024         int64_t ret_ref = 0;
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41027         return ret_ref;
41028 }
41029
41030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41031         LDKChannelManager this_arg_conv;
41032         this_arg_conv.inner = untag_ptr(this_arg);
41033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41035         this_arg_conv.is_owned = false;
41036         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
41037         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
41038         return tag_ptr(ret_ret, true);
41039 }
41040
41041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
41042         LDKUserConfig config_conv;
41043         config_conv.inner = untag_ptr(config);
41044         config_conv.is_owned = ptr_is_owned(config);
41045         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41046         config_conv.is_owned = false;
41047         LDKInitFeatures ret_var = provided_init_features(&config_conv);
41048         int64_t ret_ref = 0;
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41051         return ret_ref;
41052 }
41053
41054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41055         LDKCounterpartyForwardingInfo obj_conv;
41056         obj_conv.inner = untag_ptr(obj);
41057         obj_conv.is_owned = ptr_is_owned(obj);
41058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41059         obj_conv.is_owned = false;
41060         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
41061         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41062         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41063         CVec_u8Z_free(ret_var);
41064         return ret_arr;
41065 }
41066
41067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41068         LDKu8slice ser_ref;
41069         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41070         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41071         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
41072         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
41073         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41074         return tag_ptr(ret_conv, true);
41075 }
41076
41077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
41078         LDKChannelCounterparty obj_conv;
41079         obj_conv.inner = untag_ptr(obj);
41080         obj_conv.is_owned = ptr_is_owned(obj);
41081         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41082         obj_conv.is_owned = false;
41083         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
41084         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41085         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41086         CVec_u8Z_free(ret_var);
41087         return ret_arr;
41088 }
41089
41090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41091         LDKu8slice ser_ref;
41092         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41093         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41094         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
41095         *ret_conv = ChannelCounterparty_read(ser_ref);
41096         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41097         return tag_ptr(ret_conv, true);
41098 }
41099
41100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
41101         LDKChannelDetails obj_conv;
41102         obj_conv.inner = untag_ptr(obj);
41103         obj_conv.is_owned = ptr_is_owned(obj);
41104         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41105         obj_conv.is_owned = false;
41106         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
41107         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41108         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41109         CVec_u8Z_free(ret_var);
41110         return ret_arr;
41111 }
41112
41113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41114         LDKu8slice ser_ref;
41115         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41116         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41117         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
41118         *ret_conv = ChannelDetails_read(ser_ref);
41119         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41120         return tag_ptr(ret_conv, true);
41121 }
41122
41123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
41124         LDKPhantomRouteHints obj_conv;
41125         obj_conv.inner = untag_ptr(obj);
41126         obj_conv.is_owned = ptr_is_owned(obj);
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41128         obj_conv.is_owned = false;
41129         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
41130         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41131         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41132         CVec_u8Z_free(ret_var);
41133         return ret_arr;
41134 }
41135
41136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41137         LDKu8slice ser_ref;
41138         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41139         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41140         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
41141         *ret_conv = PhantomRouteHints_read(ser_ref);
41142         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41143         return tag_ptr(ret_conv, true);
41144 }
41145
41146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
41147         LDKChannelManager obj_conv;
41148         obj_conv.inner = untag_ptr(obj);
41149         obj_conv.is_owned = ptr_is_owned(obj);
41150         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41151         obj_conv.is_owned = false;
41152         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
41153         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41154         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41155         CVec_u8Z_free(ret_var);
41156         return ret_arr;
41157 }
41158
41159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
41160         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
41161         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
41162         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41163         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41164         CVec_u8Z_free(ret_var);
41165         return ret_arr;
41166 }
41167
41168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41169         LDKu8slice ser_ref;
41170         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41171         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41172         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
41173         *ret_conv = ChannelShutdownState_read(ser_ref);
41174         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41175         return tag_ptr(ret_conv, true);
41176 }
41177
41178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41179         LDKChannelManagerReadArgs this_obj_conv;
41180         this_obj_conv.inner = untag_ptr(this_obj);
41181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41183         ChannelManagerReadArgs_free(this_obj_conv);
41184 }
41185
41186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
41187         LDKChannelManagerReadArgs this_ptr_conv;
41188         this_ptr_conv.inner = untag_ptr(this_ptr);
41189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41191         this_ptr_conv.is_owned = false;
41192         // WARNING: This object doesn't live past this scope, needs clone!
41193         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
41194         return ret_ret;
41195 }
41196
41197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41198         LDKChannelManagerReadArgs this_ptr_conv;
41199         this_ptr_conv.inner = untag_ptr(this_ptr);
41200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41202         this_ptr_conv.is_owned = false;
41203         void* val_ptr = untag_ptr(val);
41204         CHECK_ACCESS(val_ptr);
41205         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
41206         if (val_conv.free == LDKEntropySource_JCalls_free) {
41207                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41208                 LDKEntropySource_JCalls_cloned(&val_conv);
41209         }
41210         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
41211 }
41212
41213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
41214         LDKChannelManagerReadArgs this_ptr_conv;
41215         this_ptr_conv.inner = untag_ptr(this_ptr);
41216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41218         this_ptr_conv.is_owned = false;
41219         // WARNING: This object doesn't live past this scope, needs clone!
41220         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
41221         return ret_ret;
41222 }
41223
41224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41225         LDKChannelManagerReadArgs this_ptr_conv;
41226         this_ptr_conv.inner = untag_ptr(this_ptr);
41227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41229         this_ptr_conv.is_owned = false;
41230         void* val_ptr = untag_ptr(val);
41231         CHECK_ACCESS(val_ptr);
41232         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
41233         if (val_conv.free == LDKNodeSigner_JCalls_free) {
41234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41235                 LDKNodeSigner_JCalls_cloned(&val_conv);
41236         }
41237         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
41238 }
41239
41240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
41241         LDKChannelManagerReadArgs this_ptr_conv;
41242         this_ptr_conv.inner = untag_ptr(this_ptr);
41243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41245         this_ptr_conv.is_owned = false;
41246         // WARNING: This object doesn't live past this scope, needs clone!
41247         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
41248         return ret_ret;
41249 }
41250
41251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41252         LDKChannelManagerReadArgs this_ptr_conv;
41253         this_ptr_conv.inner = untag_ptr(this_ptr);
41254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41256         this_ptr_conv.is_owned = false;
41257         void* val_ptr = untag_ptr(val);
41258         CHECK_ACCESS(val_ptr);
41259         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
41260         if (val_conv.free == LDKSignerProvider_JCalls_free) {
41261                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41262                 LDKSignerProvider_JCalls_cloned(&val_conv);
41263         }
41264         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
41265 }
41266
41267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
41268         LDKChannelManagerReadArgs this_ptr_conv;
41269         this_ptr_conv.inner = untag_ptr(this_ptr);
41270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41272         this_ptr_conv.is_owned = false;
41273         // WARNING: This object doesn't live past this scope, needs clone!
41274         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
41275         return ret_ret;
41276 }
41277
41278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41279         LDKChannelManagerReadArgs this_ptr_conv;
41280         this_ptr_conv.inner = untag_ptr(this_ptr);
41281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41283         this_ptr_conv.is_owned = false;
41284         void* val_ptr = untag_ptr(val);
41285         CHECK_ACCESS(val_ptr);
41286         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
41287         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
41288                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41289                 LDKFeeEstimator_JCalls_cloned(&val_conv);
41290         }
41291         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
41292 }
41293
41294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
41295         LDKChannelManagerReadArgs this_ptr_conv;
41296         this_ptr_conv.inner = untag_ptr(this_ptr);
41297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41299         this_ptr_conv.is_owned = false;
41300         // WARNING: This object doesn't live past this scope, needs clone!
41301         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
41302         return ret_ret;
41303 }
41304
41305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41306         LDKChannelManagerReadArgs this_ptr_conv;
41307         this_ptr_conv.inner = untag_ptr(this_ptr);
41308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41310         this_ptr_conv.is_owned = false;
41311         void* val_ptr = untag_ptr(val);
41312         CHECK_ACCESS(val_ptr);
41313         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
41314         if (val_conv.free == LDKWatch_JCalls_free) {
41315                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41316                 LDKWatch_JCalls_cloned(&val_conv);
41317         }
41318         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
41319 }
41320
41321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
41322         LDKChannelManagerReadArgs this_ptr_conv;
41323         this_ptr_conv.inner = untag_ptr(this_ptr);
41324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41326         this_ptr_conv.is_owned = false;
41327         // WARNING: This object doesn't live past this scope, needs clone!
41328         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
41329         return ret_ret;
41330 }
41331
41332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41333         LDKChannelManagerReadArgs this_ptr_conv;
41334         this_ptr_conv.inner = untag_ptr(this_ptr);
41335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41337         this_ptr_conv.is_owned = false;
41338         void* val_ptr = untag_ptr(val);
41339         CHECK_ACCESS(val_ptr);
41340         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
41341         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
41342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41343                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
41344         }
41345         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
41346 }
41347
41348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
41349         LDKChannelManagerReadArgs this_ptr_conv;
41350         this_ptr_conv.inner = untag_ptr(this_ptr);
41351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41353         this_ptr_conv.is_owned = false;
41354         // WARNING: This object doesn't live past this scope, needs clone!
41355         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
41356         return ret_ret;
41357 }
41358
41359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41360         LDKChannelManagerReadArgs this_ptr_conv;
41361         this_ptr_conv.inner = untag_ptr(this_ptr);
41362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41364         this_ptr_conv.is_owned = false;
41365         void* val_ptr = untag_ptr(val);
41366         CHECK_ACCESS(val_ptr);
41367         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
41368         if (val_conv.free == LDKRouter_JCalls_free) {
41369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41370                 LDKRouter_JCalls_cloned(&val_conv);
41371         }
41372         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
41373 }
41374
41375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
41376         LDKChannelManagerReadArgs this_ptr_conv;
41377         this_ptr_conv.inner = untag_ptr(this_ptr);
41378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41380         this_ptr_conv.is_owned = false;
41381         // WARNING: This object doesn't live past this scope, needs clone!
41382         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
41383         return ret_ret;
41384 }
41385
41386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41387         LDKChannelManagerReadArgs this_ptr_conv;
41388         this_ptr_conv.inner = untag_ptr(this_ptr);
41389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41391         this_ptr_conv.is_owned = false;
41392         void* val_ptr = untag_ptr(val);
41393         CHECK_ACCESS(val_ptr);
41394         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
41395         if (val_conv.free == LDKLogger_JCalls_free) {
41396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41397                 LDKLogger_JCalls_cloned(&val_conv);
41398         }
41399         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
41400 }
41401
41402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
41403         LDKChannelManagerReadArgs this_ptr_conv;
41404         this_ptr_conv.inner = untag_ptr(this_ptr);
41405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41407         this_ptr_conv.is_owned = false;
41408         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
41409         int64_t ret_ref = 0;
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41412         return ret_ref;
41413 }
41414
41415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41416         LDKChannelManagerReadArgs this_ptr_conv;
41417         this_ptr_conv.inner = untag_ptr(this_ptr);
41418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41420         this_ptr_conv.is_owned = false;
41421         LDKUserConfig val_conv;
41422         val_conv.inner = untag_ptr(val);
41423         val_conv.is_owned = ptr_is_owned(val);
41424         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41425         val_conv = UserConfig_clone(&val_conv);
41426         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
41427 }
41428
41429 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) {
41430         void* entropy_source_ptr = untag_ptr(entropy_source);
41431         CHECK_ACCESS(entropy_source_ptr);
41432         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41433         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41434                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41435                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41436         }
41437         void* node_signer_ptr = untag_ptr(node_signer);
41438         CHECK_ACCESS(node_signer_ptr);
41439         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41440         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41442                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41443         }
41444         void* signer_provider_ptr = untag_ptr(signer_provider);
41445         CHECK_ACCESS(signer_provider_ptr);
41446         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41447         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41449                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41450         }
41451         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41452         CHECK_ACCESS(fee_estimator_ptr);
41453         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41454         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41455                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41456                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41457         }
41458         void* chain_monitor_ptr = untag_ptr(chain_monitor);
41459         CHECK_ACCESS(chain_monitor_ptr);
41460         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
41461         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
41462                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41463                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
41464         }
41465         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
41466         CHECK_ACCESS(tx_broadcaster_ptr);
41467         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
41468         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41469                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41470                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
41471         }
41472         void* router_ptr = untag_ptr(router);
41473         CHECK_ACCESS(router_ptr);
41474         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41475         if (router_conv.free == LDKRouter_JCalls_free) {
41476                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41477                 LDKRouter_JCalls_cloned(&router_conv);
41478         }
41479         void* logger_ptr = untag_ptr(logger);
41480         CHECK_ACCESS(logger_ptr);
41481         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41482         if (logger_conv.free == LDKLogger_JCalls_free) {
41483                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41484                 LDKLogger_JCalls_cloned(&logger_conv);
41485         }
41486         LDKUserConfig default_config_conv;
41487         default_config_conv.inner = untag_ptr(default_config);
41488         default_config_conv.is_owned = ptr_is_owned(default_config);
41489         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
41490         default_config_conv = UserConfig_clone(&default_config_conv);
41491         LDKCVec_ChannelMonitorZ channel_monitors_constr;
41492         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
41493         if (channel_monitors_constr.datalen > 0)
41494                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
41495         else
41496                 channel_monitors_constr.data = NULL;
41497         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
41498         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
41499                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
41500                 LDKChannelMonitor channel_monitors_conv_16_conv;
41501                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
41502                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
41503                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
41504                 channel_monitors_conv_16_conv.is_owned = false;
41505                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
41506         }
41507         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
41508         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);
41509         int64_t ret_ref = 0;
41510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41512         return ret_ref;
41513 }
41514
41515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
41516         LDKu8slice ser_ref;
41517         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41518         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41519         LDKChannelManagerReadArgs arg_conv;
41520         arg_conv.inner = untag_ptr(arg);
41521         arg_conv.is_owned = ptr_is_owned(arg);
41522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41523         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
41524         
41525         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
41526         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
41527         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41528         return tag_ptr(ret_conv, true);
41529 }
41530
41531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41532         LDKExpandedKey this_obj_conv;
41533         this_obj_conv.inner = untag_ptr(this_obj);
41534         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41536         ExpandedKey_free(this_obj_conv);
41537 }
41538
41539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
41540         uint8_t key_material_arr[32];
41541         CHECK((*env)->GetArrayLength(env, key_material) == 32);
41542         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
41543         uint8_t (*key_material_ref)[32] = &key_material_arr;
41544         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
41545         int64_t ret_ref = 0;
41546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41548         return ret_ref;
41549 }
41550
41551 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) {
41552         LDKExpandedKey keys_conv;
41553         keys_conv.inner = untag_ptr(keys);
41554         keys_conv.is_owned = ptr_is_owned(keys);
41555         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
41556         keys_conv.is_owned = false;
41557         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41558         CHECK_ACCESS(min_value_msat_ptr);
41559         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41560         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41561         void* entropy_source_ptr = untag_ptr(entropy_source);
41562         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
41563         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
41564         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
41565         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
41566         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
41567         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
41568         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
41569         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
41570         return tag_ptr(ret_conv, true);
41571 }
41572
41573 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) {
41574         LDKExpandedKey keys_conv;
41575         keys_conv.inner = untag_ptr(keys);
41576         keys_conv.is_owned = ptr_is_owned(keys);
41577         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
41578         keys_conv.is_owned = false;
41579         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41580         CHECK_ACCESS(min_value_msat_ptr);
41581         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41582         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41583         LDKThirtyTwoBytes payment_hash_ref;
41584         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41585         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
41586         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
41587         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
41588         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
41589         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
41590         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
41591         *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);
41592         return tag_ptr(ret_conv, true);
41593 }
41594
41595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41596         if (!ptr_is_owned(this_ptr)) return;
41597         void* this_ptr_ptr = untag_ptr(this_ptr);
41598         CHECK_ACCESS(this_ptr_ptr);
41599         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
41600         FREE(untag_ptr(this_ptr));
41601         DecodeError_free(this_ptr_conv);
41602 }
41603
41604 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
41605         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41606         *ret_copy = DecodeError_clone(arg);
41607         int64_t ret_ref = tag_ptr(ret_copy, true);
41608         return ret_ref;
41609 }
41610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41611         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
41612         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
41613         return ret_conv;
41614 }
41615
41616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41617         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
41618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41619         *ret_copy = DecodeError_clone(orig_conv);
41620         int64_t ret_ref = tag_ptr(ret_copy, true);
41621         return ret_ref;
41622 }
41623
41624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
41625         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41626         *ret_copy = DecodeError_unknown_version();
41627         int64_t ret_ref = tag_ptr(ret_copy, true);
41628         return ret_ref;
41629 }
41630
41631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
41632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41633         *ret_copy = DecodeError_unknown_required_feature();
41634         int64_t ret_ref = tag_ptr(ret_copy, true);
41635         return ret_ref;
41636 }
41637
41638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
41639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41640         *ret_copy = DecodeError_invalid_value();
41641         int64_t ret_ref = tag_ptr(ret_copy, true);
41642         return ret_ref;
41643 }
41644
41645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
41646         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41647         *ret_copy = DecodeError_short_read();
41648         int64_t ret_ref = tag_ptr(ret_copy, true);
41649         return ret_ref;
41650 }
41651
41652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
41653         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41654         *ret_copy = DecodeError_bad_length_descriptor();
41655         int64_t ret_ref = tag_ptr(ret_copy, true);
41656         return ret_ref;
41657 }
41658
41659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
41660         LDKIOError a_conv = LDKIOError_from_java(env, a);
41661         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41662         *ret_copy = DecodeError_io(a_conv);
41663         int64_t ret_ref = tag_ptr(ret_copy, true);
41664         return ret_ref;
41665 }
41666
41667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
41668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41669         *ret_copy = DecodeError_unsupported_compression();
41670         int64_t ret_ref = tag_ptr(ret_copy, true);
41671         return ret_ref;
41672 }
41673
41674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41675         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
41676         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
41677         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
41678         return ret_conv;
41679 }
41680
41681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41682         LDKInit this_obj_conv;
41683         this_obj_conv.inner = untag_ptr(this_obj);
41684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41686         Init_free(this_obj_conv);
41687 }
41688
41689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41690         LDKInit this_ptr_conv;
41691         this_ptr_conv.inner = untag_ptr(this_ptr);
41692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41694         this_ptr_conv.is_owned = false;
41695         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
41696         int64_t ret_ref = 0;
41697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41699         return ret_ref;
41700 }
41701
41702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41703         LDKInit this_ptr_conv;
41704         this_ptr_conv.inner = untag_ptr(this_ptr);
41705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41707         this_ptr_conv.is_owned = false;
41708         LDKInitFeatures val_conv;
41709         val_conv.inner = untag_ptr(val);
41710         val_conv.is_owned = ptr_is_owned(val);
41711         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41712         val_conv = InitFeatures_clone(&val_conv);
41713         Init_set_features(&this_ptr_conv, val_conv);
41714 }
41715
41716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
41717         LDKInit this_ptr_conv;
41718         this_ptr_conv.inner = untag_ptr(this_ptr);
41719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41721         this_ptr_conv.is_owned = false;
41722         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
41723         *ret_copy = Init_get_networks(&this_ptr_conv);
41724         int64_t ret_ref = tag_ptr(ret_copy, true);
41725         return ret_ref;
41726 }
41727
41728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41729         LDKInit this_ptr_conv;
41730         this_ptr_conv.inner = untag_ptr(this_ptr);
41731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41733         this_ptr_conv.is_owned = false;
41734         void* val_ptr = untag_ptr(val);
41735         CHECK_ACCESS(val_ptr);
41736         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
41737         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
41738         Init_set_networks(&this_ptr_conv, val_conv);
41739 }
41740
41741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
41742         LDKInit 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         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
41748         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
41749         int64_t ret_ref = tag_ptr(ret_copy, true);
41750         return ret_ref;
41751 }
41752
41753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41754         LDKInit this_ptr_conv;
41755         this_ptr_conv.inner = untag_ptr(this_ptr);
41756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41758         this_ptr_conv.is_owned = false;
41759         void* val_ptr = untag_ptr(val);
41760         CHECK_ACCESS(val_ptr);
41761         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
41762         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
41763         Init_set_remote_network_address(&this_ptr_conv, val_conv);
41764 }
41765
41766 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) {
41767         LDKInitFeatures features_arg_conv;
41768         features_arg_conv.inner = untag_ptr(features_arg);
41769         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41770         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41771         features_arg_conv = InitFeatures_clone(&features_arg_conv);
41772         void* networks_arg_ptr = untag_ptr(networks_arg);
41773         CHECK_ACCESS(networks_arg_ptr);
41774         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
41775         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
41776         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
41777         CHECK_ACCESS(remote_network_address_arg_ptr);
41778         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
41779         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
41780         int64_t ret_ref = 0;
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41783         return ret_ref;
41784 }
41785
41786 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
41787         LDKInit ret_var = Init_clone(arg);
41788         int64_t ret_ref = 0;
41789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41791         return ret_ref;
41792 }
41793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41794         LDKInit arg_conv;
41795         arg_conv.inner = untag_ptr(arg);
41796         arg_conv.is_owned = ptr_is_owned(arg);
41797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41798         arg_conv.is_owned = false;
41799         int64_t ret_conv = Init_clone_ptr(&arg_conv);
41800         return ret_conv;
41801 }
41802
41803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41804         LDKInit orig_conv;
41805         orig_conv.inner = untag_ptr(orig);
41806         orig_conv.is_owned = ptr_is_owned(orig);
41807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41808         orig_conv.is_owned = false;
41809         LDKInit ret_var = Init_clone(&orig_conv);
41810         int64_t ret_ref = 0;
41811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41813         return ret_ref;
41814 }
41815
41816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41817         LDKInit a_conv;
41818         a_conv.inner = untag_ptr(a);
41819         a_conv.is_owned = ptr_is_owned(a);
41820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41821         a_conv.is_owned = false;
41822         LDKInit b_conv;
41823         b_conv.inner = untag_ptr(b);
41824         b_conv.is_owned = ptr_is_owned(b);
41825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41826         b_conv.is_owned = false;
41827         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
41828         return ret_conv;
41829 }
41830
41831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41832         LDKErrorMessage this_obj_conv;
41833         this_obj_conv.inner = untag_ptr(this_obj);
41834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41836         ErrorMessage_free(this_obj_conv);
41837 }
41838
41839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41840         LDKErrorMessage this_ptr_conv;
41841         this_ptr_conv.inner = untag_ptr(this_ptr);
41842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41844         this_ptr_conv.is_owned = false;
41845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
41847         return ret_arr;
41848 }
41849
41850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41851         LDKErrorMessage this_ptr_conv;
41852         this_ptr_conv.inner = untag_ptr(this_ptr);
41853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41855         this_ptr_conv.is_owned = false;
41856         LDKThirtyTwoBytes val_ref;
41857         CHECK((*env)->GetArrayLength(env, val) == 32);
41858         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41859         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
41860 }
41861
41862 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
41863         LDKErrorMessage this_ptr_conv;
41864         this_ptr_conv.inner = untag_ptr(this_ptr);
41865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41867         this_ptr_conv.is_owned = false;
41868         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
41869         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41870         Str_free(ret_str);
41871         return ret_conv;
41872 }
41873
41874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41875         LDKErrorMessage this_ptr_conv;
41876         this_ptr_conv.inner = untag_ptr(this_ptr);
41877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41879         this_ptr_conv.is_owned = false;
41880         LDKStr val_conv = java_to_owned_str(env, val);
41881         ErrorMessage_set_data(&this_ptr_conv, val_conv);
41882 }
41883
41884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
41885         LDKThirtyTwoBytes channel_id_arg_ref;
41886         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
41887         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
41888         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
41889         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
41890         int64_t ret_ref = 0;
41891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41893         return ret_ref;
41894 }
41895
41896 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
41897         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
41898         int64_t ret_ref = 0;
41899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41901         return ret_ref;
41902 }
41903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41904         LDKErrorMessage arg_conv;
41905         arg_conv.inner = untag_ptr(arg);
41906         arg_conv.is_owned = ptr_is_owned(arg);
41907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41908         arg_conv.is_owned = false;
41909         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
41910         return ret_conv;
41911 }
41912
41913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41914         LDKErrorMessage orig_conv;
41915         orig_conv.inner = untag_ptr(orig);
41916         orig_conv.is_owned = ptr_is_owned(orig);
41917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41918         orig_conv.is_owned = false;
41919         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
41920         int64_t ret_ref = 0;
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41923         return ret_ref;
41924 }
41925
41926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41927         LDKErrorMessage a_conv;
41928         a_conv.inner = untag_ptr(a);
41929         a_conv.is_owned = ptr_is_owned(a);
41930         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41931         a_conv.is_owned = false;
41932         LDKErrorMessage b_conv;
41933         b_conv.inner = untag_ptr(b);
41934         b_conv.is_owned = ptr_is_owned(b);
41935         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41936         b_conv.is_owned = false;
41937         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
41938         return ret_conv;
41939 }
41940
41941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41942         LDKWarningMessage this_obj_conv;
41943         this_obj_conv.inner = untag_ptr(this_obj);
41944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41946         WarningMessage_free(this_obj_conv);
41947 }
41948
41949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41950         LDKWarningMessage this_ptr_conv;
41951         this_ptr_conv.inner = untag_ptr(this_ptr);
41952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41954         this_ptr_conv.is_owned = false;
41955         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41956         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
41957         return ret_arr;
41958 }
41959
41960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41961         LDKWarningMessage this_ptr_conv;
41962         this_ptr_conv.inner = untag_ptr(this_ptr);
41963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41965         this_ptr_conv.is_owned = false;
41966         LDKThirtyTwoBytes val_ref;
41967         CHECK((*env)->GetArrayLength(env, val) == 32);
41968         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41969         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
41970 }
41971
41972 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
41973         LDKWarningMessage this_ptr_conv;
41974         this_ptr_conv.inner = untag_ptr(this_ptr);
41975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41977         this_ptr_conv.is_owned = false;
41978         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
41979         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41980         Str_free(ret_str);
41981         return ret_conv;
41982 }
41983
41984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41985         LDKWarningMessage 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         LDKStr val_conv = java_to_owned_str(env, val);
41991         WarningMessage_set_data(&this_ptr_conv, val_conv);
41992 }
41993
41994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
41995         LDKThirtyTwoBytes channel_id_arg_ref;
41996         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
41997         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
41998         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
41999         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
42000         int64_t ret_ref = 0;
42001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42003         return ret_ref;
42004 }
42005
42006 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
42007         LDKWarningMessage ret_var = WarningMessage_clone(arg);
42008         int64_t ret_ref = 0;
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42011         return ret_ref;
42012 }
42013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42014         LDKWarningMessage arg_conv;
42015         arg_conv.inner = untag_ptr(arg);
42016         arg_conv.is_owned = ptr_is_owned(arg);
42017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42018         arg_conv.is_owned = false;
42019         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
42020         return ret_conv;
42021 }
42022
42023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42024         LDKWarningMessage orig_conv;
42025         orig_conv.inner = untag_ptr(orig);
42026         orig_conv.is_owned = ptr_is_owned(orig);
42027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42028         orig_conv.is_owned = false;
42029         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
42030         int64_t ret_ref = 0;
42031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42033         return ret_ref;
42034 }
42035
42036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42037         LDKWarningMessage a_conv;
42038         a_conv.inner = untag_ptr(a);
42039         a_conv.is_owned = ptr_is_owned(a);
42040         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42041         a_conv.is_owned = false;
42042         LDKWarningMessage b_conv;
42043         b_conv.inner = untag_ptr(b);
42044         b_conv.is_owned = ptr_is_owned(b);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42046         b_conv.is_owned = false;
42047         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
42048         return ret_conv;
42049 }
42050
42051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42052         LDKPing this_obj_conv;
42053         this_obj_conv.inner = untag_ptr(this_obj);
42054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42056         Ping_free(this_obj_conv);
42057 }
42058
42059 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42060         LDKPing this_ptr_conv;
42061         this_ptr_conv.inner = untag_ptr(this_ptr);
42062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42064         this_ptr_conv.is_owned = false;
42065         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
42066         return ret_conv;
42067 }
42068
42069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42070         LDKPing this_ptr_conv;
42071         this_ptr_conv.inner = untag_ptr(this_ptr);
42072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42074         this_ptr_conv.is_owned = false;
42075         Ping_set_ponglen(&this_ptr_conv, val);
42076 }
42077
42078 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42079         LDKPing this_ptr_conv;
42080         this_ptr_conv.inner = untag_ptr(this_ptr);
42081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42083         this_ptr_conv.is_owned = false;
42084         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
42085         return ret_conv;
42086 }
42087
42088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42089         LDKPing this_ptr_conv;
42090         this_ptr_conv.inner = untag_ptr(this_ptr);
42091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42093         this_ptr_conv.is_owned = false;
42094         Ping_set_byteslen(&this_ptr_conv, val);
42095 }
42096
42097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
42098         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
42099         int64_t ret_ref = 0;
42100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42102         return ret_ref;
42103 }
42104
42105 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
42106         LDKPing ret_var = Ping_clone(arg);
42107         int64_t ret_ref = 0;
42108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42110         return ret_ref;
42111 }
42112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42113         LDKPing arg_conv;
42114         arg_conv.inner = untag_ptr(arg);
42115         arg_conv.is_owned = ptr_is_owned(arg);
42116         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42117         arg_conv.is_owned = false;
42118         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
42119         return ret_conv;
42120 }
42121
42122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42123         LDKPing orig_conv;
42124         orig_conv.inner = untag_ptr(orig);
42125         orig_conv.is_owned = ptr_is_owned(orig);
42126         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42127         orig_conv.is_owned = false;
42128         LDKPing ret_var = Ping_clone(&orig_conv);
42129         int64_t ret_ref = 0;
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42132         return ret_ref;
42133 }
42134
42135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42136         LDKPing a_conv;
42137         a_conv.inner = untag_ptr(a);
42138         a_conv.is_owned = ptr_is_owned(a);
42139         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42140         a_conv.is_owned = false;
42141         LDKPing b_conv;
42142         b_conv.inner = untag_ptr(b);
42143         b_conv.is_owned = ptr_is_owned(b);
42144         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42145         b_conv.is_owned = false;
42146         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
42147         return ret_conv;
42148 }
42149
42150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42151         LDKPong this_obj_conv;
42152         this_obj_conv.inner = untag_ptr(this_obj);
42153         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42155         Pong_free(this_obj_conv);
42156 }
42157
42158 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42159         LDKPong this_ptr_conv;
42160         this_ptr_conv.inner = untag_ptr(this_ptr);
42161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42163         this_ptr_conv.is_owned = false;
42164         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
42165         return ret_conv;
42166 }
42167
42168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42169         LDKPong this_ptr_conv;
42170         this_ptr_conv.inner = untag_ptr(this_ptr);
42171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42173         this_ptr_conv.is_owned = false;
42174         Pong_set_byteslen(&this_ptr_conv, val);
42175 }
42176
42177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
42178         LDKPong ret_var = Pong_new(byteslen_arg);
42179         int64_t ret_ref = 0;
42180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42182         return ret_ref;
42183 }
42184
42185 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
42186         LDKPong ret_var = Pong_clone(arg);
42187         int64_t ret_ref = 0;
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42190         return ret_ref;
42191 }
42192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42193         LDKPong arg_conv;
42194         arg_conv.inner = untag_ptr(arg);
42195         arg_conv.is_owned = ptr_is_owned(arg);
42196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42197         arg_conv.is_owned = false;
42198         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
42199         return ret_conv;
42200 }
42201
42202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42203         LDKPong orig_conv;
42204         orig_conv.inner = untag_ptr(orig);
42205         orig_conv.is_owned = ptr_is_owned(orig);
42206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42207         orig_conv.is_owned = false;
42208         LDKPong ret_var = Pong_clone(&orig_conv);
42209         int64_t ret_ref = 0;
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42212         return ret_ref;
42213 }
42214
42215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42216         LDKPong a_conv;
42217         a_conv.inner = untag_ptr(a);
42218         a_conv.is_owned = ptr_is_owned(a);
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42220         a_conv.is_owned = false;
42221         LDKPong b_conv;
42222         b_conv.inner = untag_ptr(b);
42223         b_conv.is_owned = ptr_is_owned(b);
42224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42225         b_conv.is_owned = false;
42226         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
42227         return ret_conv;
42228 }
42229
42230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42231         LDKOpenChannel this_obj_conv;
42232         this_obj_conv.inner = untag_ptr(this_obj);
42233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42235         OpenChannel_free(this_obj_conv);
42236 }
42237
42238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42239         LDKOpenChannel this_ptr_conv;
42240         this_ptr_conv.inner = untag_ptr(this_ptr);
42241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42243         this_ptr_conv.is_owned = false;
42244         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42245         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
42246         return ret_arr;
42247 }
42248
42249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42250         LDKOpenChannel this_ptr_conv;
42251         this_ptr_conv.inner = untag_ptr(this_ptr);
42252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42254         this_ptr_conv.is_owned = false;
42255         LDKThirtyTwoBytes val_ref;
42256         CHECK((*env)->GetArrayLength(env, val) == 32);
42257         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42258         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
42259 }
42260
42261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42262         LDKOpenChannel this_ptr_conv;
42263         this_ptr_conv.inner = untag_ptr(this_ptr);
42264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42266         this_ptr_conv.is_owned = false;
42267         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42268         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
42269         return ret_arr;
42270 }
42271
42272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42273         LDKOpenChannel this_ptr_conv;
42274         this_ptr_conv.inner = untag_ptr(this_ptr);
42275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42277         this_ptr_conv.is_owned = false;
42278         LDKThirtyTwoBytes val_ref;
42279         CHECK((*env)->GetArrayLength(env, val) == 32);
42280         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42281         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42282 }
42283
42284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42285         LDKOpenChannel this_ptr_conv;
42286         this_ptr_conv.inner = untag_ptr(this_ptr);
42287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42289         this_ptr_conv.is_owned = false;
42290         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
42291         return ret_conv;
42292 }
42293
42294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42295         LDKOpenChannel this_ptr_conv;
42296         this_ptr_conv.inner = untag_ptr(this_ptr);
42297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42299         this_ptr_conv.is_owned = false;
42300         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
42301 }
42302
42303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42304         LDKOpenChannel this_ptr_conv;
42305         this_ptr_conv.inner = untag_ptr(this_ptr);
42306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42308         this_ptr_conv.is_owned = false;
42309         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
42310         return ret_conv;
42311 }
42312
42313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42314         LDKOpenChannel this_ptr_conv;
42315         this_ptr_conv.inner = untag_ptr(this_ptr);
42316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42318         this_ptr_conv.is_owned = false;
42319         OpenChannel_set_push_msat(&this_ptr_conv, val);
42320 }
42321
42322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42323         LDKOpenChannel this_ptr_conv;
42324         this_ptr_conv.inner = untag_ptr(this_ptr);
42325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42327         this_ptr_conv.is_owned = false;
42328         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
42329         return ret_conv;
42330 }
42331
42332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42333         LDKOpenChannel this_ptr_conv;
42334         this_ptr_conv.inner = untag_ptr(this_ptr);
42335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42337         this_ptr_conv.is_owned = false;
42338         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42339 }
42340
42341 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) {
42342         LDKOpenChannel this_ptr_conv;
42343         this_ptr_conv.inner = untag_ptr(this_ptr);
42344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42346         this_ptr_conv.is_owned = false;
42347         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42348         return ret_conv;
42349 }
42350
42351 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) {
42352         LDKOpenChannel this_ptr_conv;
42353         this_ptr_conv.inner = untag_ptr(this_ptr);
42354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42356         this_ptr_conv.is_owned = false;
42357         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42358 }
42359
42360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42361         LDKOpenChannel this_ptr_conv;
42362         this_ptr_conv.inner = untag_ptr(this_ptr);
42363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42365         this_ptr_conv.is_owned = false;
42366         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
42367         return ret_conv;
42368 }
42369
42370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42371         LDKOpenChannel this_ptr_conv;
42372         this_ptr_conv.inner = untag_ptr(this_ptr);
42373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42375         this_ptr_conv.is_owned = false;
42376         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
42377 }
42378
42379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42380         LDKOpenChannel this_ptr_conv;
42381         this_ptr_conv.inner = untag_ptr(this_ptr);
42382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42384         this_ptr_conv.is_owned = false;
42385         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
42386         return ret_conv;
42387 }
42388
42389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42390         LDKOpenChannel this_ptr_conv;
42391         this_ptr_conv.inner = untag_ptr(this_ptr);
42392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42394         this_ptr_conv.is_owned = false;
42395         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
42396 }
42397
42398 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
42399         LDKOpenChannel this_ptr_conv;
42400         this_ptr_conv.inner = untag_ptr(this_ptr);
42401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42403         this_ptr_conv.is_owned = false;
42404         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
42405         return ret_conv;
42406 }
42407
42408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42409         LDKOpenChannel this_ptr_conv;
42410         this_ptr_conv.inner = untag_ptr(this_ptr);
42411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42413         this_ptr_conv.is_owned = false;
42414         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
42415 }
42416
42417 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42418         LDKOpenChannel this_ptr_conv;
42419         this_ptr_conv.inner = untag_ptr(this_ptr);
42420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42422         this_ptr_conv.is_owned = false;
42423         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
42424         return ret_conv;
42425 }
42426
42427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42428         LDKOpenChannel this_ptr_conv;
42429         this_ptr_conv.inner = untag_ptr(this_ptr);
42430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42432         this_ptr_conv.is_owned = false;
42433         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
42434 }
42435
42436 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42437         LDKOpenChannel this_ptr_conv;
42438         this_ptr_conv.inner = untag_ptr(this_ptr);
42439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42441         this_ptr_conv.is_owned = false;
42442         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
42443         return ret_conv;
42444 }
42445
42446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42447         LDKOpenChannel this_ptr_conv;
42448         this_ptr_conv.inner = untag_ptr(this_ptr);
42449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42451         this_ptr_conv.is_owned = false;
42452         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
42453 }
42454
42455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42456         LDKOpenChannel this_ptr_conv;
42457         this_ptr_conv.inner = untag_ptr(this_ptr);
42458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42460         this_ptr_conv.is_owned = false;
42461         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42462         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
42463         return ret_arr;
42464 }
42465
42466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42467         LDKOpenChannel this_ptr_conv;
42468         this_ptr_conv.inner = untag_ptr(this_ptr);
42469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42471         this_ptr_conv.is_owned = false;
42472         LDKPublicKey val_ref;
42473         CHECK((*env)->GetArrayLength(env, val) == 33);
42474         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42475         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
42476 }
42477
42478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42479         LDKOpenChannel 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42485         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
42486         return ret_arr;
42487 }
42488
42489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42490         LDKOpenChannel this_ptr_conv;
42491         this_ptr_conv.inner = untag_ptr(this_ptr);
42492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42494         this_ptr_conv.is_owned = false;
42495         LDKPublicKey val_ref;
42496         CHECK((*env)->GetArrayLength(env, val) == 33);
42497         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42498         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
42499 }
42500
42501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42502         LDKOpenChannel this_ptr_conv;
42503         this_ptr_conv.inner = untag_ptr(this_ptr);
42504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42506         this_ptr_conv.is_owned = false;
42507         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42508         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
42509         return ret_arr;
42510 }
42511
42512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42513         LDKOpenChannel this_ptr_conv;
42514         this_ptr_conv.inner = untag_ptr(this_ptr);
42515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42517         this_ptr_conv.is_owned = false;
42518         LDKPublicKey val_ref;
42519         CHECK((*env)->GetArrayLength(env, val) == 33);
42520         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42521         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
42522 }
42523
42524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42525         LDKOpenChannel this_ptr_conv;
42526         this_ptr_conv.inner = untag_ptr(this_ptr);
42527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42529         this_ptr_conv.is_owned = false;
42530         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42531         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
42532         return ret_arr;
42533 }
42534
42535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42536         LDKOpenChannel this_ptr_conv;
42537         this_ptr_conv.inner = untag_ptr(this_ptr);
42538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42540         this_ptr_conv.is_owned = false;
42541         LDKPublicKey val_ref;
42542         CHECK((*env)->GetArrayLength(env, val) == 33);
42543         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42544         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42545 }
42546
42547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42548         LDKOpenChannel this_ptr_conv;
42549         this_ptr_conv.inner = untag_ptr(this_ptr);
42550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42552         this_ptr_conv.is_owned = false;
42553         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42554         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
42555         return ret_arr;
42556 }
42557
42558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42559         LDKOpenChannel this_ptr_conv;
42560         this_ptr_conv.inner = untag_ptr(this_ptr);
42561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42563         this_ptr_conv.is_owned = false;
42564         LDKPublicKey val_ref;
42565         CHECK((*env)->GetArrayLength(env, val) == 33);
42566         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42567         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
42568 }
42569
42570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42571         LDKOpenChannel this_ptr_conv;
42572         this_ptr_conv.inner = untag_ptr(this_ptr);
42573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42575         this_ptr_conv.is_owned = false;
42576         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42577         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
42578         return ret_arr;
42579 }
42580
42581 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) {
42582         LDKOpenChannel this_ptr_conv;
42583         this_ptr_conv.inner = untag_ptr(this_ptr);
42584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42586         this_ptr_conv.is_owned = false;
42587         LDKPublicKey val_ref;
42588         CHECK((*env)->GetArrayLength(env, val) == 33);
42589         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42590         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42591 }
42592
42593 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
42594         LDKOpenChannel this_ptr_conv;
42595         this_ptr_conv.inner = untag_ptr(this_ptr);
42596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42598         this_ptr_conv.is_owned = false;
42599         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
42600         return ret_conv;
42601 }
42602
42603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
42604         LDKOpenChannel this_ptr_conv;
42605         this_ptr_conv.inner = untag_ptr(this_ptr);
42606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42608         this_ptr_conv.is_owned = false;
42609         OpenChannel_set_channel_flags(&this_ptr_conv, val);
42610 }
42611
42612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42613         LDKOpenChannel this_ptr_conv;
42614         this_ptr_conv.inner = untag_ptr(this_ptr);
42615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42617         this_ptr_conv.is_owned = false;
42618         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42619         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
42620         int64_t ret_ref = tag_ptr(ret_copy, true);
42621         return ret_ref;
42622 }
42623
42624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42625         LDKOpenChannel this_ptr_conv;
42626         this_ptr_conv.inner = untag_ptr(this_ptr);
42627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42629         this_ptr_conv.is_owned = false;
42630         void* val_ptr = untag_ptr(val);
42631         CHECK_ACCESS(val_ptr);
42632         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42633         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42634         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42635 }
42636
42637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
42638         LDKOpenChannel this_ptr_conv;
42639         this_ptr_conv.inner = untag_ptr(this_ptr);
42640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42642         this_ptr_conv.is_owned = false;
42643         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
42644         int64_t ret_ref = 0;
42645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42647         return ret_ref;
42648 }
42649
42650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42651         LDKOpenChannel this_ptr_conv;
42652         this_ptr_conv.inner = untag_ptr(this_ptr);
42653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42655         this_ptr_conv.is_owned = false;
42656         LDKChannelTypeFeatures val_conv;
42657         val_conv.inner = untag_ptr(val);
42658         val_conv.is_owned = ptr_is_owned(val);
42659         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42660         val_conv = ChannelTypeFeatures_clone(&val_conv);
42661         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
42662 }
42663
42664 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) {
42665         LDKThirtyTwoBytes chain_hash_arg_ref;
42666         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
42667         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
42668         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42669         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
42670         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
42671         LDKPublicKey funding_pubkey_arg_ref;
42672         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
42673         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
42674         LDKPublicKey revocation_basepoint_arg_ref;
42675         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
42676         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
42677         LDKPublicKey payment_point_arg_ref;
42678         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
42679         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
42680         LDKPublicKey delayed_payment_basepoint_arg_ref;
42681         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
42682         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
42683         LDKPublicKey htlc_basepoint_arg_ref;
42684         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
42685         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
42686         LDKPublicKey first_per_commitment_point_arg_ref;
42687         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
42688         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
42689         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42690         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42691         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42692         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42693         LDKChannelTypeFeatures channel_type_arg_conv;
42694         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42695         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42696         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42697         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42698         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);
42699         int64_t ret_ref = 0;
42700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42702         return ret_ref;
42703 }
42704
42705 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
42706         LDKOpenChannel ret_var = OpenChannel_clone(arg);
42707         int64_t ret_ref = 0;
42708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42710         return ret_ref;
42711 }
42712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42713         LDKOpenChannel arg_conv;
42714         arg_conv.inner = untag_ptr(arg);
42715         arg_conv.is_owned = ptr_is_owned(arg);
42716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42717         arg_conv.is_owned = false;
42718         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
42719         return ret_conv;
42720 }
42721
42722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42723         LDKOpenChannel orig_conv;
42724         orig_conv.inner = untag_ptr(orig);
42725         orig_conv.is_owned = ptr_is_owned(orig);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42727         orig_conv.is_owned = false;
42728         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
42729         int64_t ret_ref = 0;
42730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42732         return ret_ref;
42733 }
42734
42735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42736         LDKOpenChannel a_conv;
42737         a_conv.inner = untag_ptr(a);
42738         a_conv.is_owned = ptr_is_owned(a);
42739         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42740         a_conv.is_owned = false;
42741         LDKOpenChannel b_conv;
42742         b_conv.inner = untag_ptr(b);
42743         b_conv.is_owned = ptr_is_owned(b);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42745         b_conv.is_owned = false;
42746         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
42747         return ret_conv;
42748 }
42749
42750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42751         LDKOpenChannelV2 this_obj_conv;
42752         this_obj_conv.inner = untag_ptr(this_obj);
42753         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42755         OpenChannelV2_free(this_obj_conv);
42756 }
42757
42758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42759         LDKOpenChannelV2 this_ptr_conv;
42760         this_ptr_conv.inner = untag_ptr(this_ptr);
42761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42763         this_ptr_conv.is_owned = false;
42764         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42765         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
42766         return ret_arr;
42767 }
42768
42769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42770         LDKOpenChannelV2 this_ptr_conv;
42771         this_ptr_conv.inner = untag_ptr(this_ptr);
42772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42774         this_ptr_conv.is_owned = false;
42775         LDKThirtyTwoBytes val_ref;
42776         CHECK((*env)->GetArrayLength(env, val) == 32);
42777         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42778         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
42779 }
42780
42781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42782         LDKOpenChannelV2 this_ptr_conv;
42783         this_ptr_conv.inner = untag_ptr(this_ptr);
42784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42786         this_ptr_conv.is_owned = false;
42787         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42788         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
42789         return ret_arr;
42790 }
42791
42792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42793         LDKOpenChannelV2 this_ptr_conv;
42794         this_ptr_conv.inner = untag_ptr(this_ptr);
42795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42797         this_ptr_conv.is_owned = false;
42798         LDKThirtyTwoBytes val_ref;
42799         CHECK((*env)->GetArrayLength(env, val) == 32);
42800         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42801         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
42802 }
42803
42804 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) {
42805         LDKOpenChannelV2 this_ptr_conv;
42806         this_ptr_conv.inner = untag_ptr(this_ptr);
42807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42809         this_ptr_conv.is_owned = false;
42810         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
42811         return ret_conv;
42812 }
42813
42814 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) {
42815         LDKOpenChannelV2 this_ptr_conv;
42816         this_ptr_conv.inner = untag_ptr(this_ptr);
42817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42819         this_ptr_conv.is_owned = false;
42820         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42821 }
42822
42823 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) {
42824         LDKOpenChannelV2 this_ptr_conv;
42825         this_ptr_conv.inner = untag_ptr(this_ptr);
42826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42828         this_ptr_conv.is_owned = false;
42829         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
42830         return ret_conv;
42831 }
42832
42833 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) {
42834         LDKOpenChannelV2 this_ptr_conv;
42835         this_ptr_conv.inner = untag_ptr(this_ptr);
42836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42838         this_ptr_conv.is_owned = false;
42839         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42840 }
42841
42842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42843         LDKOpenChannelV2 this_ptr_conv;
42844         this_ptr_conv.inner = untag_ptr(this_ptr);
42845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42847         this_ptr_conv.is_owned = false;
42848         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
42849         return ret_conv;
42850 }
42851
42852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42853         LDKOpenChannelV2 this_ptr_conv;
42854         this_ptr_conv.inner = untag_ptr(this_ptr);
42855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42857         this_ptr_conv.is_owned = false;
42858         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
42859 }
42860
42861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42862         LDKOpenChannelV2 this_ptr_conv;
42863         this_ptr_conv.inner = untag_ptr(this_ptr);
42864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42866         this_ptr_conv.is_owned = false;
42867         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
42868         return ret_conv;
42869 }
42870
42871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42872         LDKOpenChannelV2 this_ptr_conv;
42873         this_ptr_conv.inner = untag_ptr(this_ptr);
42874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42876         this_ptr_conv.is_owned = false;
42877         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
42878 }
42879
42880 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) {
42881         LDKOpenChannelV2 this_ptr_conv;
42882         this_ptr_conv.inner = untag_ptr(this_ptr);
42883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42885         this_ptr_conv.is_owned = false;
42886         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42887         return ret_conv;
42888 }
42889
42890 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) {
42891         LDKOpenChannelV2 this_ptr_conv;
42892         this_ptr_conv.inner = untag_ptr(this_ptr);
42893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42895         this_ptr_conv.is_owned = false;
42896         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42897 }
42898
42899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42900         LDKOpenChannelV2 this_ptr_conv;
42901         this_ptr_conv.inner = untag_ptr(this_ptr);
42902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42904         this_ptr_conv.is_owned = false;
42905         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
42906         return ret_conv;
42907 }
42908
42909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42910         LDKOpenChannelV2 this_ptr_conv;
42911         this_ptr_conv.inner = untag_ptr(this_ptr);
42912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42914         this_ptr_conv.is_owned = false;
42915         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
42916 }
42917
42918 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42919         LDKOpenChannelV2 this_ptr_conv;
42920         this_ptr_conv.inner = untag_ptr(this_ptr);
42921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42923         this_ptr_conv.is_owned = false;
42924         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
42925         return ret_conv;
42926 }
42927
42928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42929         LDKOpenChannelV2 this_ptr_conv;
42930         this_ptr_conv.inner = untag_ptr(this_ptr);
42931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42933         this_ptr_conv.is_owned = false;
42934         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
42935 }
42936
42937 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42938         LDKOpenChannelV2 this_ptr_conv;
42939         this_ptr_conv.inner = untag_ptr(this_ptr);
42940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42942         this_ptr_conv.is_owned = false;
42943         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
42944         return ret_conv;
42945 }
42946
42947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42948         LDKOpenChannelV2 this_ptr_conv;
42949         this_ptr_conv.inner = untag_ptr(this_ptr);
42950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42952         this_ptr_conv.is_owned = false;
42953         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
42954 }
42955
42956 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
42957         LDKOpenChannelV2 this_ptr_conv;
42958         this_ptr_conv.inner = untag_ptr(this_ptr);
42959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42961         this_ptr_conv.is_owned = false;
42962         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
42963         return ret_conv;
42964 }
42965
42966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42967         LDKOpenChannelV2 this_ptr_conv;
42968         this_ptr_conv.inner = untag_ptr(this_ptr);
42969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42971         this_ptr_conv.is_owned = false;
42972         OpenChannelV2_set_locktime(&this_ptr_conv, val);
42973 }
42974
42975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42976         LDKOpenChannelV2 this_ptr_conv;
42977         this_ptr_conv.inner = untag_ptr(this_ptr);
42978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42980         this_ptr_conv.is_owned = false;
42981         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42982         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
42983         return ret_arr;
42984 }
42985
42986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42987         LDKOpenChannelV2 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         LDKPublicKey val_ref;
42993         CHECK((*env)->GetArrayLength(env, val) == 33);
42994         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42995         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42996 }
42997
42998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42999         LDKOpenChannelV2 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43005         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43006         return ret_arr;
43007 }
43008
43009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43010         LDKOpenChannelV2 this_ptr_conv;
43011         this_ptr_conv.inner = untag_ptr(this_ptr);
43012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43014         this_ptr_conv.is_owned = false;
43015         LDKPublicKey val_ref;
43016         CHECK((*env)->GetArrayLength(env, val) == 33);
43017         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43018         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43019 }
43020
43021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43022         LDKOpenChannelV2 this_ptr_conv;
43023         this_ptr_conv.inner = untag_ptr(this_ptr);
43024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43026         this_ptr_conv.is_owned = false;
43027         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43028         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
43029         return ret_arr;
43030 }
43031
43032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43033         LDKOpenChannelV2 this_ptr_conv;
43034         this_ptr_conv.inner = untag_ptr(this_ptr);
43035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43037         this_ptr_conv.is_owned = false;
43038         LDKPublicKey val_ref;
43039         CHECK((*env)->GetArrayLength(env, val) == 33);
43040         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43041         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43042 }
43043
43044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43045         LDKOpenChannelV2 this_ptr_conv;
43046         this_ptr_conv.inner = untag_ptr(this_ptr);
43047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43049         this_ptr_conv.is_owned = false;
43050         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43051         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43052         return ret_arr;
43053 }
43054
43055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43056         LDKOpenChannelV2 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         LDKPublicKey val_ref;
43062         CHECK((*env)->GetArrayLength(env, val) == 33);
43063         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43064         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43065 }
43066
43067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43068         LDKOpenChannelV2 this_ptr_conv;
43069         this_ptr_conv.inner = untag_ptr(this_ptr);
43070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43072         this_ptr_conv.is_owned = false;
43073         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43074         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43075         return ret_arr;
43076 }
43077
43078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43079         LDKOpenChannelV2 this_ptr_conv;
43080         this_ptr_conv.inner = untag_ptr(this_ptr);
43081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43083         this_ptr_conv.is_owned = false;
43084         LDKPublicKey val_ref;
43085         CHECK((*env)->GetArrayLength(env, val) == 33);
43086         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43087         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43088 }
43089
43090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43091         LDKOpenChannelV2 this_ptr_conv;
43092         this_ptr_conv.inner = untag_ptr(this_ptr);
43093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43095         this_ptr_conv.is_owned = false;
43096         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43097         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43098         return ret_arr;
43099 }
43100
43101 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) {
43102         LDKOpenChannelV2 this_ptr_conv;
43103         this_ptr_conv.inner = untag_ptr(this_ptr);
43104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43106         this_ptr_conv.is_owned = false;
43107         LDKPublicKey val_ref;
43108         CHECK((*env)->GetArrayLength(env, val) == 33);
43109         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43110         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43111 }
43112
43113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43114         LDKOpenChannelV2 this_ptr_conv;
43115         this_ptr_conv.inner = untag_ptr(this_ptr);
43116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43118         this_ptr_conv.is_owned = false;
43119         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43120         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
43121         return ret_arr;
43122 }
43123
43124 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) {
43125         LDKOpenChannelV2 this_ptr_conv;
43126         this_ptr_conv.inner = untag_ptr(this_ptr);
43127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43129         this_ptr_conv.is_owned = false;
43130         LDKPublicKey val_ref;
43131         CHECK((*env)->GetArrayLength(env, val) == 33);
43132         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43133         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43134 }
43135
43136 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
43137         LDKOpenChannelV2 this_ptr_conv;
43138         this_ptr_conv.inner = untag_ptr(this_ptr);
43139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43141         this_ptr_conv.is_owned = false;
43142         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
43143         return ret_conv;
43144 }
43145
43146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43147         LDKOpenChannelV2 this_ptr_conv;
43148         this_ptr_conv.inner = untag_ptr(this_ptr);
43149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43151         this_ptr_conv.is_owned = false;
43152         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
43153 }
43154
43155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43156         LDKOpenChannelV2 this_ptr_conv;
43157         this_ptr_conv.inner = untag_ptr(this_ptr);
43158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43160         this_ptr_conv.is_owned = false;
43161         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43162         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43163         int64_t ret_ref = tag_ptr(ret_copy, true);
43164         return ret_ref;
43165 }
43166
43167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43168         LDKOpenChannelV2 this_ptr_conv;
43169         this_ptr_conv.inner = untag_ptr(this_ptr);
43170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43172         this_ptr_conv.is_owned = false;
43173         void* val_ptr = untag_ptr(val);
43174         CHECK_ACCESS(val_ptr);
43175         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43176         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43177         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43178 }
43179
43180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43181         LDKOpenChannelV2 this_ptr_conv;
43182         this_ptr_conv.inner = untag_ptr(this_ptr);
43183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43185         this_ptr_conv.is_owned = false;
43186         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
43187         int64_t ret_ref = 0;
43188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43190         return ret_ref;
43191 }
43192
43193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43194         LDKOpenChannelV2 this_ptr_conv;
43195         this_ptr_conv.inner = untag_ptr(this_ptr);
43196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198         this_ptr_conv.is_owned = false;
43199         LDKChannelTypeFeatures val_conv;
43200         val_conv.inner = untag_ptr(val);
43201         val_conv.is_owned = ptr_is_owned(val);
43202         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43203         val_conv = ChannelTypeFeatures_clone(&val_conv);
43204         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43205 }
43206
43207 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43208         LDKOpenChannelV2 this_ptr_conv;
43209         this_ptr_conv.inner = untag_ptr(this_ptr);
43210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43212         this_ptr_conv.is_owned = false;
43213         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43214         return ret_conv;
43215 }
43216
43217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
43218         LDKOpenChannelV2 this_ptr_conv;
43219         this_ptr_conv.inner = untag_ptr(this_ptr);
43220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43222         this_ptr_conv.is_owned = false;
43223         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
43224         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43225 }
43226
43227 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) {
43228         LDKThirtyTwoBytes chain_hash_arg_ref;
43229         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
43230         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
43231         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43232         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43233         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43234         LDKPublicKey funding_pubkey_arg_ref;
43235         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43236         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43237         LDKPublicKey revocation_basepoint_arg_ref;
43238         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43239         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43240         LDKPublicKey payment_basepoint_arg_ref;
43241         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
43242         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
43243         LDKPublicKey delayed_payment_basepoint_arg_ref;
43244         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43245         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43246         LDKPublicKey htlc_basepoint_arg_ref;
43247         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43248         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43249         LDKPublicKey first_per_commitment_point_arg_ref;
43250         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43251         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43252         LDKPublicKey second_per_commitment_point_arg_ref;
43253         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
43254         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
43255         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43256         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43257         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43258         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43259         LDKChannelTypeFeatures channel_type_arg_conv;
43260         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43261         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43262         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43263         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43264         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
43265         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);
43266         int64_t ret_ref = 0;
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43269         return ret_ref;
43270 }
43271
43272 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
43273         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
43274         int64_t ret_ref = 0;
43275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43277         return ret_ref;
43278 }
43279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43280         LDKOpenChannelV2 arg_conv;
43281         arg_conv.inner = untag_ptr(arg);
43282         arg_conv.is_owned = ptr_is_owned(arg);
43283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43284         arg_conv.is_owned = false;
43285         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
43286         return ret_conv;
43287 }
43288
43289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43290         LDKOpenChannelV2 orig_conv;
43291         orig_conv.inner = untag_ptr(orig);
43292         orig_conv.is_owned = ptr_is_owned(orig);
43293         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43294         orig_conv.is_owned = false;
43295         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
43296         int64_t ret_ref = 0;
43297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43299         return ret_ref;
43300 }
43301
43302 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43303         LDKOpenChannelV2 a_conv;
43304         a_conv.inner = untag_ptr(a);
43305         a_conv.is_owned = ptr_is_owned(a);
43306         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43307         a_conv.is_owned = false;
43308         LDKOpenChannelV2 b_conv;
43309         b_conv.inner = untag_ptr(b);
43310         b_conv.is_owned = ptr_is_owned(b);
43311         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43312         b_conv.is_owned = false;
43313         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
43314         return ret_conv;
43315 }
43316
43317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43318         LDKAcceptChannel this_obj_conv;
43319         this_obj_conv.inner = untag_ptr(this_obj);
43320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43322         AcceptChannel_free(this_obj_conv);
43323 }
43324
43325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43326         LDKAcceptChannel this_ptr_conv;
43327         this_ptr_conv.inner = untag_ptr(this_ptr);
43328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43330         this_ptr_conv.is_owned = false;
43331         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
43333         return ret_arr;
43334 }
43335
43336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43337         LDKAcceptChannel this_ptr_conv;
43338         this_ptr_conv.inner = untag_ptr(this_ptr);
43339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43341         this_ptr_conv.is_owned = false;
43342         LDKThirtyTwoBytes val_ref;
43343         CHECK((*env)->GetArrayLength(env, val) == 32);
43344         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43345         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
43346 }
43347
43348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43349         LDKAcceptChannel this_ptr_conv;
43350         this_ptr_conv.inner = untag_ptr(this_ptr);
43351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43353         this_ptr_conv.is_owned = false;
43354         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
43355         return ret_conv;
43356 }
43357
43358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43359         LDKAcceptChannel this_ptr_conv;
43360         this_ptr_conv.inner = untag_ptr(this_ptr);
43361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43363         this_ptr_conv.is_owned = false;
43364         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
43365 }
43366
43367 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) {
43368         LDKAcceptChannel this_ptr_conv;
43369         this_ptr_conv.inner = untag_ptr(this_ptr);
43370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43372         this_ptr_conv.is_owned = false;
43373         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43374         return ret_conv;
43375 }
43376
43377 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) {
43378         LDKAcceptChannel this_ptr_conv;
43379         this_ptr_conv.inner = untag_ptr(this_ptr);
43380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43382         this_ptr_conv.is_owned = false;
43383         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43384 }
43385
43386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43387         LDKAcceptChannel this_ptr_conv;
43388         this_ptr_conv.inner = untag_ptr(this_ptr);
43389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43391         this_ptr_conv.is_owned = false;
43392         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
43393         return ret_conv;
43394 }
43395
43396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43397         LDKAcceptChannel this_ptr_conv;
43398         this_ptr_conv.inner = untag_ptr(this_ptr);
43399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43401         this_ptr_conv.is_owned = false;
43402         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
43403 }
43404
43405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43406         LDKAcceptChannel this_ptr_conv;
43407         this_ptr_conv.inner = untag_ptr(this_ptr);
43408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43410         this_ptr_conv.is_owned = false;
43411         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
43412         return ret_conv;
43413 }
43414
43415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43416         LDKAcceptChannel this_ptr_conv;
43417         this_ptr_conv.inner = untag_ptr(this_ptr);
43418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43420         this_ptr_conv.is_owned = false;
43421         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
43422 }
43423
43424 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
43425         LDKAcceptChannel this_ptr_conv;
43426         this_ptr_conv.inner = untag_ptr(this_ptr);
43427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43429         this_ptr_conv.is_owned = false;
43430         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
43431         return ret_conv;
43432 }
43433
43434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43435         LDKAcceptChannel this_ptr_conv;
43436         this_ptr_conv.inner = untag_ptr(this_ptr);
43437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43439         this_ptr_conv.is_owned = false;
43440         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
43441 }
43442
43443 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43444         LDKAcceptChannel this_ptr_conv;
43445         this_ptr_conv.inner = untag_ptr(this_ptr);
43446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43448         this_ptr_conv.is_owned = false;
43449         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
43450         return ret_conv;
43451 }
43452
43453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43454         LDKAcceptChannel this_ptr_conv;
43455         this_ptr_conv.inner = untag_ptr(this_ptr);
43456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43458         this_ptr_conv.is_owned = false;
43459         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
43460 }
43461
43462 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43463         LDKAcceptChannel this_ptr_conv;
43464         this_ptr_conv.inner = untag_ptr(this_ptr);
43465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43467         this_ptr_conv.is_owned = false;
43468         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
43469         return ret_conv;
43470 }
43471
43472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43473         LDKAcceptChannel this_ptr_conv;
43474         this_ptr_conv.inner = untag_ptr(this_ptr);
43475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43477         this_ptr_conv.is_owned = false;
43478         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
43479 }
43480
43481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43482         LDKAcceptChannel this_ptr_conv;
43483         this_ptr_conv.inner = untag_ptr(this_ptr);
43484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43486         this_ptr_conv.is_owned = false;
43487         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43488         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
43489         return ret_arr;
43490 }
43491
43492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43493         LDKAcceptChannel 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         LDKPublicKey val_ref;
43499         CHECK((*env)->GetArrayLength(env, val) == 33);
43500         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43501         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
43502 }
43503
43504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43505         LDKAcceptChannel this_ptr_conv;
43506         this_ptr_conv.inner = untag_ptr(this_ptr);
43507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43509         this_ptr_conv.is_owned = false;
43510         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43511         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43512         return ret_arr;
43513 }
43514
43515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43516         LDKAcceptChannel this_ptr_conv;
43517         this_ptr_conv.inner = untag_ptr(this_ptr);
43518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43520         this_ptr_conv.is_owned = false;
43521         LDKPublicKey val_ref;
43522         CHECK((*env)->GetArrayLength(env, val) == 33);
43523         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43524         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
43525 }
43526
43527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43528         LDKAcceptChannel this_ptr_conv;
43529         this_ptr_conv.inner = untag_ptr(this_ptr);
43530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43532         this_ptr_conv.is_owned = false;
43533         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43534         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
43535         return ret_arr;
43536 }
43537
43538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43539         LDKAcceptChannel this_ptr_conv;
43540         this_ptr_conv.inner = untag_ptr(this_ptr);
43541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43543         this_ptr_conv.is_owned = false;
43544         LDKPublicKey val_ref;
43545         CHECK((*env)->GetArrayLength(env, val) == 33);
43546         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43547         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
43548 }
43549
43550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43551         LDKAcceptChannel this_ptr_conv;
43552         this_ptr_conv.inner = untag_ptr(this_ptr);
43553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43555         this_ptr_conv.is_owned = false;
43556         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43557         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43558         return ret_arr;
43559 }
43560
43561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43562         LDKAcceptChannel this_ptr_conv;
43563         this_ptr_conv.inner = untag_ptr(this_ptr);
43564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43566         this_ptr_conv.is_owned = false;
43567         LDKPublicKey val_ref;
43568         CHECK((*env)->GetArrayLength(env, val) == 33);
43569         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43570         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43571 }
43572
43573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43574         LDKAcceptChannel this_ptr_conv;
43575         this_ptr_conv.inner = untag_ptr(this_ptr);
43576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43578         this_ptr_conv.is_owned = false;
43579         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43580         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43581         return ret_arr;
43582 }
43583
43584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43585         LDKAcceptChannel this_ptr_conv;
43586         this_ptr_conv.inner = untag_ptr(this_ptr);
43587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43589         this_ptr_conv.is_owned = false;
43590         LDKPublicKey val_ref;
43591         CHECK((*env)->GetArrayLength(env, val) == 33);
43592         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43593         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
43594 }
43595
43596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43597         LDKAcceptChannel this_ptr_conv;
43598         this_ptr_conv.inner = untag_ptr(this_ptr);
43599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43601         this_ptr_conv.is_owned = false;
43602         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43603         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43604         return ret_arr;
43605 }
43606
43607 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) {
43608         LDKAcceptChannel this_ptr_conv;
43609         this_ptr_conv.inner = untag_ptr(this_ptr);
43610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43612         this_ptr_conv.is_owned = false;
43613         LDKPublicKey val_ref;
43614         CHECK((*env)->GetArrayLength(env, val) == 33);
43615         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43616         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43617 }
43618
43619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43620         LDKAcceptChannel this_ptr_conv;
43621         this_ptr_conv.inner = untag_ptr(this_ptr);
43622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43624         this_ptr_conv.is_owned = false;
43625         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43626         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
43627         int64_t ret_ref = tag_ptr(ret_copy, true);
43628         return ret_ref;
43629 }
43630
43631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43632         LDKAcceptChannel this_ptr_conv;
43633         this_ptr_conv.inner = untag_ptr(this_ptr);
43634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43636         this_ptr_conv.is_owned = false;
43637         void* val_ptr = untag_ptr(val);
43638         CHECK_ACCESS(val_ptr);
43639         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43640         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43641         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43642 }
43643
43644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43645         LDKAcceptChannel this_ptr_conv;
43646         this_ptr_conv.inner = untag_ptr(this_ptr);
43647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43649         this_ptr_conv.is_owned = false;
43650         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
43651         int64_t ret_ref = 0;
43652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43654         return ret_ref;
43655 }
43656
43657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43658         LDKAcceptChannel this_ptr_conv;
43659         this_ptr_conv.inner = untag_ptr(this_ptr);
43660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43662         this_ptr_conv.is_owned = false;
43663         LDKChannelTypeFeatures val_conv;
43664         val_conv.inner = untag_ptr(val);
43665         val_conv.is_owned = ptr_is_owned(val);
43666         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43667         val_conv = ChannelTypeFeatures_clone(&val_conv);
43668         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
43669 }
43670
43671 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) {
43672         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43673         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43674         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43675         LDKPublicKey funding_pubkey_arg_ref;
43676         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43677         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43678         LDKPublicKey revocation_basepoint_arg_ref;
43679         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43680         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43681         LDKPublicKey payment_point_arg_ref;
43682         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
43683         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
43684         LDKPublicKey delayed_payment_basepoint_arg_ref;
43685         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43686         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43687         LDKPublicKey htlc_basepoint_arg_ref;
43688         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43689         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43690         LDKPublicKey first_per_commitment_point_arg_ref;
43691         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43692         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43693         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43694         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43695         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43696         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43697         LDKChannelTypeFeatures channel_type_arg_conv;
43698         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43699         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43701         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43702         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);
43703         int64_t ret_ref = 0;
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43706         return ret_ref;
43707 }
43708
43709 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
43710         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
43711         int64_t ret_ref = 0;
43712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43714         return ret_ref;
43715 }
43716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43717         LDKAcceptChannel arg_conv;
43718         arg_conv.inner = untag_ptr(arg);
43719         arg_conv.is_owned = ptr_is_owned(arg);
43720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43721         arg_conv.is_owned = false;
43722         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
43723         return ret_conv;
43724 }
43725
43726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43727         LDKAcceptChannel orig_conv;
43728         orig_conv.inner = untag_ptr(orig);
43729         orig_conv.is_owned = ptr_is_owned(orig);
43730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43731         orig_conv.is_owned = false;
43732         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
43733         int64_t ret_ref = 0;
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43736         return ret_ref;
43737 }
43738
43739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43740         LDKAcceptChannel a_conv;
43741         a_conv.inner = untag_ptr(a);
43742         a_conv.is_owned = ptr_is_owned(a);
43743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43744         a_conv.is_owned = false;
43745         LDKAcceptChannel b_conv;
43746         b_conv.inner = untag_ptr(b);
43747         b_conv.is_owned = ptr_is_owned(b);
43748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43749         b_conv.is_owned = false;
43750         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
43751         return ret_conv;
43752 }
43753
43754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43755         LDKAcceptChannelV2 this_obj_conv;
43756         this_obj_conv.inner = untag_ptr(this_obj);
43757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43759         AcceptChannelV2_free(this_obj_conv);
43760 }
43761
43762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43763         LDKAcceptChannelV2 this_ptr_conv;
43764         this_ptr_conv.inner = untag_ptr(this_ptr);
43765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43767         this_ptr_conv.is_owned = false;
43768         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43769         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
43770         return ret_arr;
43771 }
43772
43773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43774         LDKAcceptChannelV2 this_ptr_conv;
43775         this_ptr_conv.inner = untag_ptr(this_ptr);
43776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43778         this_ptr_conv.is_owned = false;
43779         LDKThirtyTwoBytes val_ref;
43780         CHECK((*env)->GetArrayLength(env, val) == 32);
43781         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43782         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
43783 }
43784
43785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43786         LDKAcceptChannelV2 this_ptr_conv;
43787         this_ptr_conv.inner = untag_ptr(this_ptr);
43788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43790         this_ptr_conv.is_owned = false;
43791         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
43792         return ret_conv;
43793 }
43794
43795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43796         LDKAcceptChannelV2 this_ptr_conv;
43797         this_ptr_conv.inner = untag_ptr(this_ptr);
43798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43800         this_ptr_conv.is_owned = false;
43801         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
43802 }
43803
43804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43805         LDKAcceptChannelV2 this_ptr_conv;
43806         this_ptr_conv.inner = untag_ptr(this_ptr);
43807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43809         this_ptr_conv.is_owned = false;
43810         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
43811         return ret_conv;
43812 }
43813
43814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43815         LDKAcceptChannelV2 this_ptr_conv;
43816         this_ptr_conv.inner = untag_ptr(this_ptr);
43817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43819         this_ptr_conv.is_owned = false;
43820         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
43821 }
43822
43823 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) {
43824         LDKAcceptChannelV2 this_ptr_conv;
43825         this_ptr_conv.inner = untag_ptr(this_ptr);
43826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43828         this_ptr_conv.is_owned = false;
43829         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43830         return ret_conv;
43831 }
43832
43833 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) {
43834         LDKAcceptChannelV2 this_ptr_conv;
43835         this_ptr_conv.inner = untag_ptr(this_ptr);
43836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43838         this_ptr_conv.is_owned = false;
43839         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43840 }
43841
43842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43843         LDKAcceptChannelV2 this_ptr_conv;
43844         this_ptr_conv.inner = untag_ptr(this_ptr);
43845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43847         this_ptr_conv.is_owned = false;
43848         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
43849         return ret_conv;
43850 }
43851
43852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43853         LDKAcceptChannelV2 this_ptr_conv;
43854         this_ptr_conv.inner = untag_ptr(this_ptr);
43855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43857         this_ptr_conv.is_owned = false;
43858         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
43859 }
43860
43861 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
43862         LDKAcceptChannelV2 this_ptr_conv;
43863         this_ptr_conv.inner = untag_ptr(this_ptr);
43864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43866         this_ptr_conv.is_owned = false;
43867         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
43868         return ret_conv;
43869 }
43870
43871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43872         LDKAcceptChannelV2 this_ptr_conv;
43873         this_ptr_conv.inner = untag_ptr(this_ptr);
43874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43876         this_ptr_conv.is_owned = false;
43877         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
43878 }
43879
43880 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43881         LDKAcceptChannelV2 this_ptr_conv;
43882         this_ptr_conv.inner = untag_ptr(this_ptr);
43883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43885         this_ptr_conv.is_owned = false;
43886         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
43887         return ret_conv;
43888 }
43889
43890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43891         LDKAcceptChannelV2 this_ptr_conv;
43892         this_ptr_conv.inner = untag_ptr(this_ptr);
43893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43895         this_ptr_conv.is_owned = false;
43896         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
43897 }
43898
43899 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43900         LDKAcceptChannelV2 this_ptr_conv;
43901         this_ptr_conv.inner = untag_ptr(this_ptr);
43902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43904         this_ptr_conv.is_owned = false;
43905         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
43906         return ret_conv;
43907 }
43908
43909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43910         LDKAcceptChannelV2 this_ptr_conv;
43911         this_ptr_conv.inner = untag_ptr(this_ptr);
43912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43914         this_ptr_conv.is_owned = false;
43915         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
43916 }
43917
43918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43919         LDKAcceptChannelV2 this_ptr_conv;
43920         this_ptr_conv.inner = untag_ptr(this_ptr);
43921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43923         this_ptr_conv.is_owned = false;
43924         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43925         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
43926         return ret_arr;
43927 }
43928
43929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43930         LDKAcceptChannelV2 this_ptr_conv;
43931         this_ptr_conv.inner = untag_ptr(this_ptr);
43932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43934         this_ptr_conv.is_owned = false;
43935         LDKPublicKey val_ref;
43936         CHECK((*env)->GetArrayLength(env, val) == 33);
43937         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43938         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43939 }
43940
43941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43942         LDKAcceptChannelV2 this_ptr_conv;
43943         this_ptr_conv.inner = untag_ptr(this_ptr);
43944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43946         this_ptr_conv.is_owned = false;
43947         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43948         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43949         return ret_arr;
43950 }
43951
43952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43953         LDKAcceptChannelV2 this_ptr_conv;
43954         this_ptr_conv.inner = untag_ptr(this_ptr);
43955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43957         this_ptr_conv.is_owned = false;
43958         LDKPublicKey val_ref;
43959         CHECK((*env)->GetArrayLength(env, val) == 33);
43960         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43961         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43962 }
43963
43964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43965         LDKAcceptChannelV2 this_ptr_conv;
43966         this_ptr_conv.inner = untag_ptr(this_ptr);
43967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43969         this_ptr_conv.is_owned = false;
43970         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43971         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
43972         return ret_arr;
43973 }
43974
43975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43976         LDKAcceptChannelV2 this_ptr_conv;
43977         this_ptr_conv.inner = untag_ptr(this_ptr);
43978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43980         this_ptr_conv.is_owned = false;
43981         LDKPublicKey val_ref;
43982         CHECK((*env)->GetArrayLength(env, val) == 33);
43983         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43984         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43985 }
43986
43987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43988         LDKAcceptChannelV2 this_ptr_conv;
43989         this_ptr_conv.inner = untag_ptr(this_ptr);
43990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43992         this_ptr_conv.is_owned = false;
43993         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43995         return ret_arr;
43996 }
43997
43998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43999         LDKAcceptChannelV2 this_ptr_conv;
44000         this_ptr_conv.inner = untag_ptr(this_ptr);
44001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44003         this_ptr_conv.is_owned = false;
44004         LDKPublicKey val_ref;
44005         CHECK((*env)->GetArrayLength(env, val) == 33);
44006         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44007         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
44008 }
44009
44010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44011         LDKAcceptChannelV2 this_ptr_conv;
44012         this_ptr_conv.inner = untag_ptr(this_ptr);
44013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44015         this_ptr_conv.is_owned = false;
44016         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44017         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
44018         return ret_arr;
44019 }
44020
44021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44022         LDKAcceptChannelV2 this_ptr_conv;
44023         this_ptr_conv.inner = untag_ptr(this_ptr);
44024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44026         this_ptr_conv.is_owned = false;
44027         LDKPublicKey val_ref;
44028         CHECK((*env)->GetArrayLength(env, val) == 33);
44029         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44030         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
44031 }
44032
44033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44034         LDKAcceptChannelV2 this_ptr_conv;
44035         this_ptr_conv.inner = untag_ptr(this_ptr);
44036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44038         this_ptr_conv.is_owned = false;
44039         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44040         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
44041         return ret_arr;
44042 }
44043
44044 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) {
44045         LDKAcceptChannelV2 this_ptr_conv;
44046         this_ptr_conv.inner = untag_ptr(this_ptr);
44047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44049         this_ptr_conv.is_owned = false;
44050         LDKPublicKey val_ref;
44051         CHECK((*env)->GetArrayLength(env, val) == 33);
44052         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44053         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
44054 }
44055
44056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44057         LDKAcceptChannelV2 this_ptr_conv;
44058         this_ptr_conv.inner = untag_ptr(this_ptr);
44059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44061         this_ptr_conv.is_owned = false;
44062         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44063         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
44064         return ret_arr;
44065 }
44066
44067 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) {
44068         LDKAcceptChannelV2 this_ptr_conv;
44069         this_ptr_conv.inner = untag_ptr(this_ptr);
44070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44072         this_ptr_conv.is_owned = false;
44073         LDKPublicKey val_ref;
44074         CHECK((*env)->GetArrayLength(env, val) == 33);
44075         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44076         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
44077 }
44078
44079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44080         LDKAcceptChannelV2 this_ptr_conv;
44081         this_ptr_conv.inner = untag_ptr(this_ptr);
44082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44084         this_ptr_conv.is_owned = false;
44085         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
44086         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
44087         int64_t ret_ref = tag_ptr(ret_copy, true);
44088         return ret_ref;
44089 }
44090
44091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44092         LDKAcceptChannelV2 this_ptr_conv;
44093         this_ptr_conv.inner = untag_ptr(this_ptr);
44094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44096         this_ptr_conv.is_owned = false;
44097         void* val_ptr = untag_ptr(val);
44098         CHECK_ACCESS(val_ptr);
44099         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
44100         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
44101         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
44102 }
44103
44104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
44105         LDKAcceptChannelV2 this_ptr_conv;
44106         this_ptr_conv.inner = untag_ptr(this_ptr);
44107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44109         this_ptr_conv.is_owned = false;
44110         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
44111         int64_t ret_ref = 0;
44112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44114         return ret_ref;
44115 }
44116
44117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44118         LDKAcceptChannelV2 this_ptr_conv;
44119         this_ptr_conv.inner = untag_ptr(this_ptr);
44120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44122         this_ptr_conv.is_owned = false;
44123         LDKChannelTypeFeatures val_conv;
44124         val_conv.inner = untag_ptr(val);
44125         val_conv.is_owned = ptr_is_owned(val);
44126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44127         val_conv = ChannelTypeFeatures_clone(&val_conv);
44128         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
44129 }
44130
44131 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44132         LDKAcceptChannelV2 this_ptr_conv;
44133         this_ptr_conv.inner = untag_ptr(this_ptr);
44134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44136         this_ptr_conv.is_owned = false;
44137         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
44138         return ret_conv;
44139 }
44140
44141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
44142         LDKAcceptChannelV2 this_ptr_conv;
44143         this_ptr_conv.inner = untag_ptr(this_ptr);
44144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44146         this_ptr_conv.is_owned = false;
44147         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
44148         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
44149 }
44150
44151 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) {
44152         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44153         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44154         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44155         LDKPublicKey funding_pubkey_arg_ref;
44156         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
44157         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
44158         LDKPublicKey revocation_basepoint_arg_ref;
44159         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
44160         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
44161         LDKPublicKey payment_basepoint_arg_ref;
44162         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
44163         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
44164         LDKPublicKey delayed_payment_basepoint_arg_ref;
44165         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
44166         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
44167         LDKPublicKey htlc_basepoint_arg_ref;
44168         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
44169         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
44170         LDKPublicKey first_per_commitment_point_arg_ref;
44171         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
44172         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
44173         LDKPublicKey second_per_commitment_point_arg_ref;
44174         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
44175         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
44176         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
44177         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
44178         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
44179         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
44180         LDKChannelTypeFeatures channel_type_arg_conv;
44181         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
44182         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
44183         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
44184         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
44185         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
44186         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);
44187         int64_t ret_ref = 0;
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44190         return ret_ref;
44191 }
44192
44193 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
44194         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
44195         int64_t ret_ref = 0;
44196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44198         return ret_ref;
44199 }
44200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44201         LDKAcceptChannelV2 arg_conv;
44202         arg_conv.inner = untag_ptr(arg);
44203         arg_conv.is_owned = ptr_is_owned(arg);
44204         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44205         arg_conv.is_owned = false;
44206         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
44207         return ret_conv;
44208 }
44209
44210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44211         LDKAcceptChannelV2 orig_conv;
44212         orig_conv.inner = untag_ptr(orig);
44213         orig_conv.is_owned = ptr_is_owned(orig);
44214         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44215         orig_conv.is_owned = false;
44216         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
44217         int64_t ret_ref = 0;
44218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44220         return ret_ref;
44221 }
44222
44223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44224         LDKAcceptChannelV2 a_conv;
44225         a_conv.inner = untag_ptr(a);
44226         a_conv.is_owned = ptr_is_owned(a);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44228         a_conv.is_owned = false;
44229         LDKAcceptChannelV2 b_conv;
44230         b_conv.inner = untag_ptr(b);
44231         b_conv.is_owned = ptr_is_owned(b);
44232         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44233         b_conv.is_owned = false;
44234         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
44235         return ret_conv;
44236 }
44237
44238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44239         LDKFundingCreated this_obj_conv;
44240         this_obj_conv.inner = untag_ptr(this_obj);
44241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44243         FundingCreated_free(this_obj_conv);
44244 }
44245
44246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44247         LDKFundingCreated this_ptr_conv;
44248         this_ptr_conv.inner = untag_ptr(this_ptr);
44249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44251         this_ptr_conv.is_owned = false;
44252         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44253         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
44254         return ret_arr;
44255 }
44256
44257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44258         LDKFundingCreated this_ptr_conv;
44259         this_ptr_conv.inner = untag_ptr(this_ptr);
44260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44262         this_ptr_conv.is_owned = false;
44263         LDKThirtyTwoBytes val_ref;
44264         CHECK((*env)->GetArrayLength(env, val) == 32);
44265         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44266         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
44267 }
44268
44269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
44270         LDKFundingCreated this_ptr_conv;
44271         this_ptr_conv.inner = untag_ptr(this_ptr);
44272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44274         this_ptr_conv.is_owned = false;
44275         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44276         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
44277         return ret_arr;
44278 }
44279
44280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44281         LDKFundingCreated this_ptr_conv;
44282         this_ptr_conv.inner = untag_ptr(this_ptr);
44283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44285         this_ptr_conv.is_owned = false;
44286         LDKThirtyTwoBytes val_ref;
44287         CHECK((*env)->GetArrayLength(env, val) == 32);
44288         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44289         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
44290 }
44291
44292 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
44293         LDKFundingCreated this_ptr_conv;
44294         this_ptr_conv.inner = untag_ptr(this_ptr);
44295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44297         this_ptr_conv.is_owned = false;
44298         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
44299         return ret_conv;
44300 }
44301
44302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44303         LDKFundingCreated this_ptr_conv;
44304         this_ptr_conv.inner = untag_ptr(this_ptr);
44305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44307         this_ptr_conv.is_owned = false;
44308         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
44309 }
44310
44311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44312         LDKFundingCreated this_ptr_conv;
44313         this_ptr_conv.inner = untag_ptr(this_ptr);
44314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44316         this_ptr_conv.is_owned = false;
44317         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44318         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
44319         return ret_arr;
44320 }
44321
44322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44323         LDKFundingCreated this_ptr_conv;
44324         this_ptr_conv.inner = untag_ptr(this_ptr);
44325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44327         this_ptr_conv.is_owned = false;
44328         LDKECDSASignature val_ref;
44329         CHECK((*env)->GetArrayLength(env, val) == 64);
44330         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44331         FundingCreated_set_signature(&this_ptr_conv, val_ref);
44332 }
44333
44334 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) {
44335         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44336         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44337         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44338         LDKThirtyTwoBytes funding_txid_arg_ref;
44339         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
44340         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
44341         LDKECDSASignature signature_arg_ref;
44342         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44343         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44344         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
44345         int64_t ret_ref = 0;
44346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44348         return ret_ref;
44349 }
44350
44351 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
44352         LDKFundingCreated ret_var = FundingCreated_clone(arg);
44353         int64_t ret_ref = 0;
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44356         return ret_ref;
44357 }
44358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44359         LDKFundingCreated arg_conv;
44360         arg_conv.inner = untag_ptr(arg);
44361         arg_conv.is_owned = ptr_is_owned(arg);
44362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44363         arg_conv.is_owned = false;
44364         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
44365         return ret_conv;
44366 }
44367
44368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44369         LDKFundingCreated orig_conv;
44370         orig_conv.inner = untag_ptr(orig);
44371         orig_conv.is_owned = ptr_is_owned(orig);
44372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44373         orig_conv.is_owned = false;
44374         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
44375         int64_t ret_ref = 0;
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44378         return ret_ref;
44379 }
44380
44381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44382         LDKFundingCreated a_conv;
44383         a_conv.inner = untag_ptr(a);
44384         a_conv.is_owned = ptr_is_owned(a);
44385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44386         a_conv.is_owned = false;
44387         LDKFundingCreated b_conv;
44388         b_conv.inner = untag_ptr(b);
44389         b_conv.is_owned = ptr_is_owned(b);
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44391         b_conv.is_owned = false;
44392         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
44393         return ret_conv;
44394 }
44395
44396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44397         LDKFundingSigned this_obj_conv;
44398         this_obj_conv.inner = untag_ptr(this_obj);
44399         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44401         FundingSigned_free(this_obj_conv);
44402 }
44403
44404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44405         LDKFundingSigned this_ptr_conv;
44406         this_ptr_conv.inner = untag_ptr(this_ptr);
44407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44409         this_ptr_conv.is_owned = false;
44410         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44411         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
44412         return ret_arr;
44413 }
44414
44415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44416         LDKFundingSigned this_ptr_conv;
44417         this_ptr_conv.inner = untag_ptr(this_ptr);
44418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44420         this_ptr_conv.is_owned = false;
44421         LDKThirtyTwoBytes val_ref;
44422         CHECK((*env)->GetArrayLength(env, val) == 32);
44423         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44424         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
44425 }
44426
44427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44428         LDKFundingSigned this_ptr_conv;
44429         this_ptr_conv.inner = untag_ptr(this_ptr);
44430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44432         this_ptr_conv.is_owned = false;
44433         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44434         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
44435         return ret_arr;
44436 }
44437
44438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44439         LDKFundingSigned this_ptr_conv;
44440         this_ptr_conv.inner = untag_ptr(this_ptr);
44441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44443         this_ptr_conv.is_owned = false;
44444         LDKECDSASignature val_ref;
44445         CHECK((*env)->GetArrayLength(env, val) == 64);
44446         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44447         FundingSigned_set_signature(&this_ptr_conv, val_ref);
44448 }
44449
44450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
44451         LDKThirtyTwoBytes channel_id_arg_ref;
44452         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44453         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44454         LDKECDSASignature signature_arg_ref;
44455         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44456         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44457         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
44458         int64_t ret_ref = 0;
44459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44461         return ret_ref;
44462 }
44463
44464 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
44465         LDKFundingSigned ret_var = FundingSigned_clone(arg);
44466         int64_t ret_ref = 0;
44467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44469         return ret_ref;
44470 }
44471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44472         LDKFundingSigned arg_conv;
44473         arg_conv.inner = untag_ptr(arg);
44474         arg_conv.is_owned = ptr_is_owned(arg);
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44476         arg_conv.is_owned = false;
44477         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
44478         return ret_conv;
44479 }
44480
44481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44482         LDKFundingSigned orig_conv;
44483         orig_conv.inner = untag_ptr(orig);
44484         orig_conv.is_owned = ptr_is_owned(orig);
44485         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44486         orig_conv.is_owned = false;
44487         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
44488         int64_t ret_ref = 0;
44489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44491         return ret_ref;
44492 }
44493
44494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44495         LDKFundingSigned a_conv;
44496         a_conv.inner = untag_ptr(a);
44497         a_conv.is_owned = ptr_is_owned(a);
44498         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44499         a_conv.is_owned = false;
44500         LDKFundingSigned b_conv;
44501         b_conv.inner = untag_ptr(b);
44502         b_conv.is_owned = ptr_is_owned(b);
44503         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44504         b_conv.is_owned = false;
44505         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
44506         return ret_conv;
44507 }
44508
44509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44510         LDKChannelReady this_obj_conv;
44511         this_obj_conv.inner = untag_ptr(this_obj);
44512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44514         ChannelReady_free(this_obj_conv);
44515 }
44516
44517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44518         LDKChannelReady this_ptr_conv;
44519         this_ptr_conv.inner = untag_ptr(this_ptr);
44520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44522         this_ptr_conv.is_owned = false;
44523         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44524         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
44525         return ret_arr;
44526 }
44527
44528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44529         LDKChannelReady this_ptr_conv;
44530         this_ptr_conv.inner = untag_ptr(this_ptr);
44531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44533         this_ptr_conv.is_owned = false;
44534         LDKThirtyTwoBytes val_ref;
44535         CHECK((*env)->GetArrayLength(env, val) == 32);
44536         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44537         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
44538 }
44539
44540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44541         LDKChannelReady this_ptr_conv;
44542         this_ptr_conv.inner = untag_ptr(this_ptr);
44543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44545         this_ptr_conv.is_owned = false;
44546         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44547         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
44548         return ret_arr;
44549 }
44550
44551 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) {
44552         LDKChannelReady this_ptr_conv;
44553         this_ptr_conv.inner = untag_ptr(this_ptr);
44554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44556         this_ptr_conv.is_owned = false;
44557         LDKPublicKey val_ref;
44558         CHECK((*env)->GetArrayLength(env, val) == 33);
44559         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44560         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
44561 }
44562
44563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
44564         LDKChannelReady this_ptr_conv;
44565         this_ptr_conv.inner = untag_ptr(this_ptr);
44566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44568         this_ptr_conv.is_owned = false;
44569         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44570         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
44571         int64_t ret_ref = tag_ptr(ret_copy, true);
44572         return ret_ref;
44573 }
44574
44575 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) {
44576         LDKChannelReady this_ptr_conv;
44577         this_ptr_conv.inner = untag_ptr(this_ptr);
44578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44580         this_ptr_conv.is_owned = false;
44581         void* val_ptr = untag_ptr(val);
44582         CHECK_ACCESS(val_ptr);
44583         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44584         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44585         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
44586 }
44587
44588 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) {
44589         LDKThirtyTwoBytes channel_id_arg_ref;
44590         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44591         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44592         LDKPublicKey next_per_commitment_point_arg_ref;
44593         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
44594         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
44595         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
44596         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
44597         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
44598         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
44599         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
44600         int64_t ret_ref = 0;
44601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44603         return ret_ref;
44604 }
44605
44606 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
44607         LDKChannelReady ret_var = ChannelReady_clone(arg);
44608         int64_t ret_ref = 0;
44609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44611         return ret_ref;
44612 }
44613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44614         LDKChannelReady arg_conv;
44615         arg_conv.inner = untag_ptr(arg);
44616         arg_conv.is_owned = ptr_is_owned(arg);
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44618         arg_conv.is_owned = false;
44619         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
44620         return ret_conv;
44621 }
44622
44623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44624         LDKChannelReady orig_conv;
44625         orig_conv.inner = untag_ptr(orig);
44626         orig_conv.is_owned = ptr_is_owned(orig);
44627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44628         orig_conv.is_owned = false;
44629         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
44630         int64_t ret_ref = 0;
44631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44633         return ret_ref;
44634 }
44635
44636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44637         LDKChannelReady a_conv;
44638         a_conv.inner = untag_ptr(a);
44639         a_conv.is_owned = ptr_is_owned(a);
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44641         a_conv.is_owned = false;
44642         LDKChannelReady b_conv;
44643         b_conv.inner = untag_ptr(b);
44644         b_conv.is_owned = ptr_is_owned(b);
44645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44646         b_conv.is_owned = false;
44647         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
44648         return ret_conv;
44649 }
44650
44651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44652         LDKTxAddInput this_obj_conv;
44653         this_obj_conv.inner = untag_ptr(this_obj);
44654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44656         TxAddInput_free(this_obj_conv);
44657 }
44658
44659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44660         LDKTxAddInput this_ptr_conv;
44661         this_ptr_conv.inner = untag_ptr(this_ptr);
44662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44664         this_ptr_conv.is_owned = false;
44665         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44666         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
44667         return ret_arr;
44668 }
44669
44670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44671         LDKTxAddInput this_ptr_conv;
44672         this_ptr_conv.inner = untag_ptr(this_ptr);
44673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44675         this_ptr_conv.is_owned = false;
44676         LDKThirtyTwoBytes val_ref;
44677         CHECK((*env)->GetArrayLength(env, val) == 32);
44678         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44679         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
44680 }
44681
44682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44683         LDKTxAddInput this_ptr_conv;
44684         this_ptr_conv.inner = untag_ptr(this_ptr);
44685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44687         this_ptr_conv.is_owned = false;
44688         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
44689         return ret_conv;
44690 }
44691
44692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44693         LDKTxAddInput this_ptr_conv;
44694         this_ptr_conv.inner = untag_ptr(this_ptr);
44695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44697         this_ptr_conv.is_owned = false;
44698         TxAddInput_set_serial_id(&this_ptr_conv, val);
44699 }
44700
44701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
44702         LDKTxAddInput this_ptr_conv;
44703         this_ptr_conv.inner = untag_ptr(this_ptr);
44704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44706         this_ptr_conv.is_owned = false;
44707         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
44708         int64_t ret_ref = 0;
44709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44711         return ret_ref;
44712 }
44713
44714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44715         LDKTxAddInput this_ptr_conv;
44716         this_ptr_conv.inner = untag_ptr(this_ptr);
44717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44719         this_ptr_conv.is_owned = false;
44720         LDKTransactionU16LenLimited val_conv;
44721         val_conv.inner = untag_ptr(val);
44722         val_conv.is_owned = ptr_is_owned(val);
44723         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44724         val_conv = TransactionU16LenLimited_clone(&val_conv);
44725         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
44726 }
44727
44728 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
44729         LDKTxAddInput this_ptr_conv;
44730         this_ptr_conv.inner = untag_ptr(this_ptr);
44731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44733         this_ptr_conv.is_owned = false;
44734         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
44735         return ret_conv;
44736 }
44737
44738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44739         LDKTxAddInput this_ptr_conv;
44740         this_ptr_conv.inner = untag_ptr(this_ptr);
44741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44743         this_ptr_conv.is_owned = false;
44744         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
44745 }
44746
44747 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
44748         LDKTxAddInput this_ptr_conv;
44749         this_ptr_conv.inner = untag_ptr(this_ptr);
44750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44752         this_ptr_conv.is_owned = false;
44753         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
44754         return ret_conv;
44755 }
44756
44757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44758         LDKTxAddInput this_ptr_conv;
44759         this_ptr_conv.inner = untag_ptr(this_ptr);
44760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44762         this_ptr_conv.is_owned = false;
44763         TxAddInput_set_sequence(&this_ptr_conv, val);
44764 }
44765
44766 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) {
44767         LDKThirtyTwoBytes channel_id_arg_ref;
44768         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44769         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44770         LDKTransactionU16LenLimited prevtx_arg_conv;
44771         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
44772         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
44773         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
44774         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
44775         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
44776         int64_t ret_ref = 0;
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44779         return ret_ref;
44780 }
44781
44782 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
44783         LDKTxAddInput ret_var = TxAddInput_clone(arg);
44784         int64_t ret_ref = 0;
44785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44787         return ret_ref;
44788 }
44789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44790         LDKTxAddInput arg_conv;
44791         arg_conv.inner = untag_ptr(arg);
44792         arg_conv.is_owned = ptr_is_owned(arg);
44793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44794         arg_conv.is_owned = false;
44795         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
44796         return ret_conv;
44797 }
44798
44799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44800         LDKTxAddInput orig_conv;
44801         orig_conv.inner = untag_ptr(orig);
44802         orig_conv.is_owned = ptr_is_owned(orig);
44803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44804         orig_conv.is_owned = false;
44805         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
44806         int64_t ret_ref = 0;
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44809         return ret_ref;
44810 }
44811
44812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44813         LDKTxAddInput a_conv;
44814         a_conv.inner = untag_ptr(a);
44815         a_conv.is_owned = ptr_is_owned(a);
44816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44817         a_conv.is_owned = false;
44818         LDKTxAddInput b_conv;
44819         b_conv.inner = untag_ptr(b);
44820         b_conv.is_owned = ptr_is_owned(b);
44821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44822         b_conv.is_owned = false;
44823         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
44824         return ret_conv;
44825 }
44826
44827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44828         LDKTxAddOutput this_obj_conv;
44829         this_obj_conv.inner = untag_ptr(this_obj);
44830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44832         TxAddOutput_free(this_obj_conv);
44833 }
44834
44835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44836         LDKTxAddOutput this_ptr_conv;
44837         this_ptr_conv.inner = untag_ptr(this_ptr);
44838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44840         this_ptr_conv.is_owned = false;
44841         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44842         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
44843         return ret_arr;
44844 }
44845
44846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44847         LDKTxAddOutput this_ptr_conv;
44848         this_ptr_conv.inner = untag_ptr(this_ptr);
44849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44851         this_ptr_conv.is_owned = false;
44852         LDKThirtyTwoBytes val_ref;
44853         CHECK((*env)->GetArrayLength(env, val) == 32);
44854         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44855         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
44856 }
44857
44858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44859         LDKTxAddOutput this_ptr_conv;
44860         this_ptr_conv.inner = untag_ptr(this_ptr);
44861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44863         this_ptr_conv.is_owned = false;
44864         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
44865         return ret_conv;
44866 }
44867
44868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44869         LDKTxAddOutput this_ptr_conv;
44870         this_ptr_conv.inner = untag_ptr(this_ptr);
44871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44873         this_ptr_conv.is_owned = false;
44874         TxAddOutput_set_serial_id(&this_ptr_conv, val);
44875 }
44876
44877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
44878         LDKTxAddOutput this_ptr_conv;
44879         this_ptr_conv.inner = untag_ptr(this_ptr);
44880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44882         this_ptr_conv.is_owned = false;
44883         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
44884         return ret_conv;
44885 }
44886
44887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44888         LDKTxAddOutput this_ptr_conv;
44889         this_ptr_conv.inner = untag_ptr(this_ptr);
44890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44892         this_ptr_conv.is_owned = false;
44893         TxAddOutput_set_sats(&this_ptr_conv, val);
44894 }
44895
44896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
44897         LDKTxAddOutput this_ptr_conv;
44898         this_ptr_conv.inner = untag_ptr(this_ptr);
44899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44901         this_ptr_conv.is_owned = false;
44902         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
44903         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44904         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44905         return ret_arr;
44906 }
44907
44908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44909         LDKTxAddOutput this_ptr_conv;
44910         this_ptr_conv.inner = untag_ptr(this_ptr);
44911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44913         this_ptr_conv.is_owned = false;
44914         LDKCVec_u8Z val_ref;
44915         val_ref.datalen = (*env)->GetArrayLength(env, val);
44916         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44917         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
44918         TxAddOutput_set_script(&this_ptr_conv, val_ref);
44919 }
44920
44921 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) {
44922         LDKThirtyTwoBytes channel_id_arg_ref;
44923         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44924         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44925         LDKCVec_u8Z script_arg_ref;
44926         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
44927         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44928         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
44929         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
44930         int64_t ret_ref = 0;
44931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44933         return ret_ref;
44934 }
44935
44936 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
44937         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
44938         int64_t ret_ref = 0;
44939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44941         return ret_ref;
44942 }
44943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44944         LDKTxAddOutput arg_conv;
44945         arg_conv.inner = untag_ptr(arg);
44946         arg_conv.is_owned = ptr_is_owned(arg);
44947         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44948         arg_conv.is_owned = false;
44949         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
44950         return ret_conv;
44951 }
44952
44953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44954         LDKTxAddOutput orig_conv;
44955         orig_conv.inner = untag_ptr(orig);
44956         orig_conv.is_owned = ptr_is_owned(orig);
44957         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44958         orig_conv.is_owned = false;
44959         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
44960         int64_t ret_ref = 0;
44961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44963         return ret_ref;
44964 }
44965
44966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44967         LDKTxAddOutput a_conv;
44968         a_conv.inner = untag_ptr(a);
44969         a_conv.is_owned = ptr_is_owned(a);
44970         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44971         a_conv.is_owned = false;
44972         LDKTxAddOutput b_conv;
44973         b_conv.inner = untag_ptr(b);
44974         b_conv.is_owned = ptr_is_owned(b);
44975         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44976         b_conv.is_owned = false;
44977         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
44978         return ret_conv;
44979 }
44980
44981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44982         LDKTxRemoveInput this_obj_conv;
44983         this_obj_conv.inner = untag_ptr(this_obj);
44984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44986         TxRemoveInput_free(this_obj_conv);
44987 }
44988
44989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44990         LDKTxRemoveInput this_ptr_conv;
44991         this_ptr_conv.inner = untag_ptr(this_ptr);
44992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44994         this_ptr_conv.is_owned = false;
44995         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44996         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
44997         return ret_arr;
44998 }
44999
45000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45001         LDKTxRemoveInput this_ptr_conv;
45002         this_ptr_conv.inner = untag_ptr(this_ptr);
45003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45005         this_ptr_conv.is_owned = false;
45006         LDKThirtyTwoBytes val_ref;
45007         CHECK((*env)->GetArrayLength(env, val) == 32);
45008         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45009         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
45010 }
45011
45012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45013         LDKTxRemoveInput this_ptr_conv;
45014         this_ptr_conv.inner = untag_ptr(this_ptr);
45015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45017         this_ptr_conv.is_owned = false;
45018         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
45019         return ret_conv;
45020 }
45021
45022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45023         LDKTxRemoveInput this_ptr_conv;
45024         this_ptr_conv.inner = untag_ptr(this_ptr);
45025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45027         this_ptr_conv.is_owned = false;
45028         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
45029 }
45030
45031 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) {
45032         LDKThirtyTwoBytes channel_id_arg_ref;
45033         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45034         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45035         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
45036         int64_t ret_ref = 0;
45037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45039         return ret_ref;
45040 }
45041
45042 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
45043         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
45044         int64_t ret_ref = 0;
45045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45047         return ret_ref;
45048 }
45049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45050         LDKTxRemoveInput arg_conv;
45051         arg_conv.inner = untag_ptr(arg);
45052         arg_conv.is_owned = ptr_is_owned(arg);
45053         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45054         arg_conv.is_owned = false;
45055         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
45056         return ret_conv;
45057 }
45058
45059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45060         LDKTxRemoveInput orig_conv;
45061         orig_conv.inner = untag_ptr(orig);
45062         orig_conv.is_owned = ptr_is_owned(orig);
45063         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45064         orig_conv.is_owned = false;
45065         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
45066         int64_t ret_ref = 0;
45067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45069         return ret_ref;
45070 }
45071
45072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45073         LDKTxRemoveInput a_conv;
45074         a_conv.inner = untag_ptr(a);
45075         a_conv.is_owned = ptr_is_owned(a);
45076         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45077         a_conv.is_owned = false;
45078         LDKTxRemoveInput b_conv;
45079         b_conv.inner = untag_ptr(b);
45080         b_conv.is_owned = ptr_is_owned(b);
45081         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45082         b_conv.is_owned = false;
45083         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
45084         return ret_conv;
45085 }
45086
45087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45088         LDKTxRemoveOutput this_obj_conv;
45089         this_obj_conv.inner = untag_ptr(this_obj);
45090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45092         TxRemoveOutput_free(this_obj_conv);
45093 }
45094
45095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45096         LDKTxRemoveOutput this_ptr_conv;
45097         this_ptr_conv.inner = untag_ptr(this_ptr);
45098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45100         this_ptr_conv.is_owned = false;
45101         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
45103         return ret_arr;
45104 }
45105
45106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45107         LDKTxRemoveOutput this_ptr_conv;
45108         this_ptr_conv.inner = untag_ptr(this_ptr);
45109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45111         this_ptr_conv.is_owned = false;
45112         LDKThirtyTwoBytes val_ref;
45113         CHECK((*env)->GetArrayLength(env, val) == 32);
45114         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45115         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
45116 }
45117
45118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45119         LDKTxRemoveOutput this_ptr_conv;
45120         this_ptr_conv.inner = untag_ptr(this_ptr);
45121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45123         this_ptr_conv.is_owned = false;
45124         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
45125         return ret_conv;
45126 }
45127
45128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45129         LDKTxRemoveOutput this_ptr_conv;
45130         this_ptr_conv.inner = untag_ptr(this_ptr);
45131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45133         this_ptr_conv.is_owned = false;
45134         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
45135 }
45136
45137 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) {
45138         LDKThirtyTwoBytes channel_id_arg_ref;
45139         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45140         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45141         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
45142         int64_t ret_ref = 0;
45143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45145         return ret_ref;
45146 }
45147
45148 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
45149         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
45150         int64_t ret_ref = 0;
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45153         return ret_ref;
45154 }
45155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45156         LDKTxRemoveOutput arg_conv;
45157         arg_conv.inner = untag_ptr(arg);
45158         arg_conv.is_owned = ptr_is_owned(arg);
45159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45160         arg_conv.is_owned = false;
45161         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
45162         return ret_conv;
45163 }
45164
45165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45166         LDKTxRemoveOutput orig_conv;
45167         orig_conv.inner = untag_ptr(orig);
45168         orig_conv.is_owned = ptr_is_owned(orig);
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45170         orig_conv.is_owned = false;
45171         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
45172         int64_t ret_ref = 0;
45173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45175         return ret_ref;
45176 }
45177
45178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45179         LDKTxRemoveOutput a_conv;
45180         a_conv.inner = untag_ptr(a);
45181         a_conv.is_owned = ptr_is_owned(a);
45182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45183         a_conv.is_owned = false;
45184         LDKTxRemoveOutput b_conv;
45185         b_conv.inner = untag_ptr(b);
45186         b_conv.is_owned = ptr_is_owned(b);
45187         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45188         b_conv.is_owned = false;
45189         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
45190         return ret_conv;
45191 }
45192
45193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45194         LDKTxComplete this_obj_conv;
45195         this_obj_conv.inner = untag_ptr(this_obj);
45196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45198         TxComplete_free(this_obj_conv);
45199 }
45200
45201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45202         LDKTxComplete this_ptr_conv;
45203         this_ptr_conv.inner = untag_ptr(this_ptr);
45204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45206         this_ptr_conv.is_owned = false;
45207         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45208         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
45209         return ret_arr;
45210 }
45211
45212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45213         LDKTxComplete this_ptr_conv;
45214         this_ptr_conv.inner = untag_ptr(this_ptr);
45215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45217         this_ptr_conv.is_owned = false;
45218         LDKThirtyTwoBytes val_ref;
45219         CHECK((*env)->GetArrayLength(env, val) == 32);
45220         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45221         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
45222 }
45223
45224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
45225         LDKThirtyTwoBytes channel_id_arg_ref;
45226         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45227         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45228         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
45229         int64_t ret_ref = 0;
45230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45232         return ret_ref;
45233 }
45234
45235 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
45236         LDKTxComplete ret_var = TxComplete_clone(arg);
45237         int64_t ret_ref = 0;
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45240         return ret_ref;
45241 }
45242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45243         LDKTxComplete arg_conv;
45244         arg_conv.inner = untag_ptr(arg);
45245         arg_conv.is_owned = ptr_is_owned(arg);
45246         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45247         arg_conv.is_owned = false;
45248         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
45249         return ret_conv;
45250 }
45251
45252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45253         LDKTxComplete orig_conv;
45254         orig_conv.inner = untag_ptr(orig);
45255         orig_conv.is_owned = ptr_is_owned(orig);
45256         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45257         orig_conv.is_owned = false;
45258         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
45259         int64_t ret_ref = 0;
45260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45262         return ret_ref;
45263 }
45264
45265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45266         LDKTxComplete a_conv;
45267         a_conv.inner = untag_ptr(a);
45268         a_conv.is_owned = ptr_is_owned(a);
45269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45270         a_conv.is_owned = false;
45271         LDKTxComplete b_conv;
45272         b_conv.inner = untag_ptr(b);
45273         b_conv.is_owned = ptr_is_owned(b);
45274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45275         b_conv.is_owned = false;
45276         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
45277         return ret_conv;
45278 }
45279
45280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45281         LDKTxSignatures this_obj_conv;
45282         this_obj_conv.inner = untag_ptr(this_obj);
45283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45285         TxSignatures_free(this_obj_conv);
45286 }
45287
45288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45289         LDKTxSignatures this_ptr_conv;
45290         this_ptr_conv.inner = untag_ptr(this_ptr);
45291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45293         this_ptr_conv.is_owned = false;
45294         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45295         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
45296         return ret_arr;
45297 }
45298
45299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45300         LDKTxSignatures this_ptr_conv;
45301         this_ptr_conv.inner = untag_ptr(this_ptr);
45302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45304         this_ptr_conv.is_owned = false;
45305         LDKThirtyTwoBytes val_ref;
45306         CHECK((*env)->GetArrayLength(env, val) == 32);
45307         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45308         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
45309 }
45310
45311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
45312         LDKTxSignatures this_ptr_conv;
45313         this_ptr_conv.inner = untag_ptr(this_ptr);
45314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45316         this_ptr_conv.is_owned = false;
45317         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45318         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
45319         return ret_arr;
45320 }
45321
45322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45323         LDKTxSignatures this_ptr_conv;
45324         this_ptr_conv.inner = untag_ptr(this_ptr);
45325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45327         this_ptr_conv.is_owned = false;
45328         LDKThirtyTwoBytes val_ref;
45329         CHECK((*env)->GetArrayLength(env, val) == 32);
45330         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45331         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45332 }
45333
45334 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
45335         LDKTxSignatures this_ptr_conv;
45336         this_ptr_conv.inner = untag_ptr(this_ptr);
45337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45339         this_ptr_conv.is_owned = false;
45340         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45341         jobjectArray ret_arr = NULL;
45342         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
45343         ;
45344         for (size_t i = 0; i < ret_var.datalen; i++) {
45345                 LDKWitness ret_conv_8_var = ret_var.data[i];
45346                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
45347                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
45348                 Witness_free(ret_conv_8_var);
45349                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
45350         }
45351         
45352         FREE(ret_var.data);
45353         return ret_arr;
45354 }
45355
45356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45357         LDKTxSignatures this_ptr_conv;
45358         this_ptr_conv.inner = untag_ptr(this_ptr);
45359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45361         this_ptr_conv.is_owned = false;
45362         LDKCVec_WitnessZ val_constr;
45363         val_constr.datalen = (*env)->GetArrayLength(env, val);
45364         if (val_constr.datalen > 0)
45365                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45366         else
45367                 val_constr.data = NULL;
45368         for (size_t i = 0; i < val_constr.datalen; i++) {
45369                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
45370                 LDKWitness val_conv_8_ref;
45371                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
45372                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
45373                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
45374                 val_conv_8_ref.data_is_owned = true;
45375                 val_constr.data[i] = val_conv_8_ref;
45376         }
45377         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
45378 }
45379
45380 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) {
45381         LDKThirtyTwoBytes channel_id_arg_ref;
45382         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45383         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45384         LDKThirtyTwoBytes tx_hash_arg_ref;
45385         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
45386         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
45387         LDKCVec_WitnessZ witnesses_arg_constr;
45388         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
45389         if (witnesses_arg_constr.datalen > 0)
45390                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45391         else
45392                 witnesses_arg_constr.data = NULL;
45393         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
45394                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
45395                 LDKWitness witnesses_arg_conv_8_ref;
45396                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
45397                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
45398                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
45399                 witnesses_arg_conv_8_ref.data_is_owned = true;
45400                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
45401         }
45402         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
45403         int64_t ret_ref = 0;
45404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45406         return ret_ref;
45407 }
45408
45409 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
45410         LDKTxSignatures ret_var = TxSignatures_clone(arg);
45411         int64_t ret_ref = 0;
45412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45414         return ret_ref;
45415 }
45416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45417         LDKTxSignatures arg_conv;
45418         arg_conv.inner = untag_ptr(arg);
45419         arg_conv.is_owned = ptr_is_owned(arg);
45420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45421         arg_conv.is_owned = false;
45422         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
45423         return ret_conv;
45424 }
45425
45426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45427         LDKTxSignatures orig_conv;
45428         orig_conv.inner = untag_ptr(orig);
45429         orig_conv.is_owned = ptr_is_owned(orig);
45430         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45431         orig_conv.is_owned = false;
45432         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
45433         int64_t ret_ref = 0;
45434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45436         return ret_ref;
45437 }
45438
45439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45440         LDKTxSignatures a_conv;
45441         a_conv.inner = untag_ptr(a);
45442         a_conv.is_owned = ptr_is_owned(a);
45443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45444         a_conv.is_owned = false;
45445         LDKTxSignatures b_conv;
45446         b_conv.inner = untag_ptr(b);
45447         b_conv.is_owned = ptr_is_owned(b);
45448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45449         b_conv.is_owned = false;
45450         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
45451         return ret_conv;
45452 }
45453
45454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45455         LDKTxInitRbf this_obj_conv;
45456         this_obj_conv.inner = untag_ptr(this_obj);
45457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45459         TxInitRbf_free(this_obj_conv);
45460 }
45461
45462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45463         LDKTxInitRbf this_ptr_conv;
45464         this_ptr_conv.inner = untag_ptr(this_ptr);
45465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45467         this_ptr_conv.is_owned = false;
45468         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45469         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
45470         return ret_arr;
45471 }
45472
45473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45474         LDKTxInitRbf this_ptr_conv;
45475         this_ptr_conv.inner = untag_ptr(this_ptr);
45476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45478         this_ptr_conv.is_owned = false;
45479         LDKThirtyTwoBytes val_ref;
45480         CHECK((*env)->GetArrayLength(env, val) == 32);
45481         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45482         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
45483 }
45484
45485 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
45486         LDKTxInitRbf this_ptr_conv;
45487         this_ptr_conv.inner = untag_ptr(this_ptr);
45488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45490         this_ptr_conv.is_owned = false;
45491         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
45492         return ret_conv;
45493 }
45494
45495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45496         LDKTxInitRbf this_ptr_conv;
45497         this_ptr_conv.inner = untag_ptr(this_ptr);
45498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45500         this_ptr_conv.is_owned = false;
45501         TxInitRbf_set_locktime(&this_ptr_conv, val);
45502 }
45503
45504 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
45505         LDKTxInitRbf this_ptr_conv;
45506         this_ptr_conv.inner = untag_ptr(this_ptr);
45507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45509         this_ptr_conv.is_owned = false;
45510         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45511         return ret_conv;
45512 }
45513
45514 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) {
45515         LDKTxInitRbf this_ptr_conv;
45516         this_ptr_conv.inner = untag_ptr(this_ptr);
45517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45519         this_ptr_conv.is_owned = false;
45520         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45521 }
45522
45523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
45524         LDKTxInitRbf this_ptr_conv;
45525         this_ptr_conv.inner = untag_ptr(this_ptr);
45526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45528         this_ptr_conv.is_owned = false;
45529         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45530         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
45531         int64_t ret_ref = tag_ptr(ret_copy, true);
45532         return ret_ref;
45533 }
45534
45535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45536         LDKTxInitRbf this_ptr_conv;
45537         this_ptr_conv.inner = untag_ptr(this_ptr);
45538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45540         this_ptr_conv.is_owned = false;
45541         void* val_ptr = untag_ptr(val);
45542         CHECK_ACCESS(val_ptr);
45543         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45544         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45545         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45546 }
45547
45548 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) {
45549         LDKThirtyTwoBytes channel_id_arg_ref;
45550         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45551         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45552         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45553         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45554         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45555         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45556         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
45557         int64_t ret_ref = 0;
45558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45560         return ret_ref;
45561 }
45562
45563 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
45564         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
45565         int64_t ret_ref = 0;
45566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45568         return ret_ref;
45569 }
45570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45571         LDKTxInitRbf arg_conv;
45572         arg_conv.inner = untag_ptr(arg);
45573         arg_conv.is_owned = ptr_is_owned(arg);
45574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45575         arg_conv.is_owned = false;
45576         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
45577         return ret_conv;
45578 }
45579
45580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45581         LDKTxInitRbf orig_conv;
45582         orig_conv.inner = untag_ptr(orig);
45583         orig_conv.is_owned = ptr_is_owned(orig);
45584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45585         orig_conv.is_owned = false;
45586         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
45587         int64_t ret_ref = 0;
45588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45590         return ret_ref;
45591 }
45592
45593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45594         LDKTxInitRbf a_conv;
45595         a_conv.inner = untag_ptr(a);
45596         a_conv.is_owned = ptr_is_owned(a);
45597         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45598         a_conv.is_owned = false;
45599         LDKTxInitRbf b_conv;
45600         b_conv.inner = untag_ptr(b);
45601         b_conv.is_owned = ptr_is_owned(b);
45602         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45603         b_conv.is_owned = false;
45604         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
45605         return ret_conv;
45606 }
45607
45608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45609         LDKTxAckRbf this_obj_conv;
45610         this_obj_conv.inner = untag_ptr(this_obj);
45611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45613         TxAckRbf_free(this_obj_conv);
45614 }
45615
45616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45617         LDKTxAckRbf this_ptr_conv;
45618         this_ptr_conv.inner = untag_ptr(this_ptr);
45619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45621         this_ptr_conv.is_owned = false;
45622         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45623         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
45624         return ret_arr;
45625 }
45626
45627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45628         LDKTxAckRbf this_ptr_conv;
45629         this_ptr_conv.inner = untag_ptr(this_ptr);
45630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45632         this_ptr_conv.is_owned = false;
45633         LDKThirtyTwoBytes val_ref;
45634         CHECK((*env)->GetArrayLength(env, val) == 32);
45635         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45636         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
45637 }
45638
45639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
45640         LDKTxAckRbf this_ptr_conv;
45641         this_ptr_conv.inner = untag_ptr(this_ptr);
45642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45644         this_ptr_conv.is_owned = false;
45645         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45646         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
45647         int64_t ret_ref = tag_ptr(ret_copy, true);
45648         return ret_ref;
45649 }
45650
45651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45652         LDKTxAckRbf this_ptr_conv;
45653         this_ptr_conv.inner = untag_ptr(this_ptr);
45654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45656         this_ptr_conv.is_owned = false;
45657         void* val_ptr = untag_ptr(val);
45658         CHECK_ACCESS(val_ptr);
45659         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45660         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45661         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45662 }
45663
45664 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) {
45665         LDKThirtyTwoBytes channel_id_arg_ref;
45666         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45667         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45668         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45669         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45670         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45671         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45672         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
45673         int64_t ret_ref = 0;
45674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45676         return ret_ref;
45677 }
45678
45679 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
45680         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
45681         int64_t ret_ref = 0;
45682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45684         return ret_ref;
45685 }
45686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45687         LDKTxAckRbf arg_conv;
45688         arg_conv.inner = untag_ptr(arg);
45689         arg_conv.is_owned = ptr_is_owned(arg);
45690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45691         arg_conv.is_owned = false;
45692         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
45693         return ret_conv;
45694 }
45695
45696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45697         LDKTxAckRbf orig_conv;
45698         orig_conv.inner = untag_ptr(orig);
45699         orig_conv.is_owned = ptr_is_owned(orig);
45700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45701         orig_conv.is_owned = false;
45702         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
45703         int64_t ret_ref = 0;
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45706         return ret_ref;
45707 }
45708
45709 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45710         LDKTxAckRbf a_conv;
45711         a_conv.inner = untag_ptr(a);
45712         a_conv.is_owned = ptr_is_owned(a);
45713         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45714         a_conv.is_owned = false;
45715         LDKTxAckRbf b_conv;
45716         b_conv.inner = untag_ptr(b);
45717         b_conv.is_owned = ptr_is_owned(b);
45718         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45719         b_conv.is_owned = false;
45720         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
45721         return ret_conv;
45722 }
45723
45724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45725         LDKTxAbort this_obj_conv;
45726         this_obj_conv.inner = untag_ptr(this_obj);
45727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45729         TxAbort_free(this_obj_conv);
45730 }
45731
45732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45733         LDKTxAbort this_ptr_conv;
45734         this_ptr_conv.inner = untag_ptr(this_ptr);
45735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45737         this_ptr_conv.is_owned = false;
45738         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45739         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
45740         return ret_arr;
45741 }
45742
45743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45744         LDKTxAbort this_ptr_conv;
45745         this_ptr_conv.inner = untag_ptr(this_ptr);
45746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45748         this_ptr_conv.is_owned = false;
45749         LDKThirtyTwoBytes val_ref;
45750         CHECK((*env)->GetArrayLength(env, val) == 32);
45751         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45752         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
45753 }
45754
45755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45756         LDKTxAbort this_ptr_conv;
45757         this_ptr_conv.inner = untag_ptr(this_ptr);
45758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45760         this_ptr_conv.is_owned = false;
45761         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
45762         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45763         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45764         CVec_u8Z_free(ret_var);
45765         return ret_arr;
45766 }
45767
45768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45769         LDKTxAbort this_ptr_conv;
45770         this_ptr_conv.inner = untag_ptr(this_ptr);
45771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45773         this_ptr_conv.is_owned = false;
45774         LDKCVec_u8Z val_ref;
45775         val_ref.datalen = (*env)->GetArrayLength(env, val);
45776         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45777         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45778         TxAbort_set_data(&this_ptr_conv, val_ref);
45779 }
45780
45781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
45782         LDKThirtyTwoBytes channel_id_arg_ref;
45783         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45784         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45785         LDKCVec_u8Z data_arg_ref;
45786         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
45787         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45788         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
45789         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_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 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
45797         LDKTxAbort ret_var = TxAbort_clone(arg);
45798         int64_t ret_ref = 0;
45799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45801         return ret_ref;
45802 }
45803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45804         LDKTxAbort arg_conv;
45805         arg_conv.inner = untag_ptr(arg);
45806         arg_conv.is_owned = ptr_is_owned(arg);
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45808         arg_conv.is_owned = false;
45809         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
45810         return ret_conv;
45811 }
45812
45813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45814         LDKTxAbort orig_conv;
45815         orig_conv.inner = untag_ptr(orig);
45816         orig_conv.is_owned = ptr_is_owned(orig);
45817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45818         orig_conv.is_owned = false;
45819         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
45820         int64_t ret_ref = 0;
45821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45823         return ret_ref;
45824 }
45825
45826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45827         LDKTxAbort a_conv;
45828         a_conv.inner = untag_ptr(a);
45829         a_conv.is_owned = ptr_is_owned(a);
45830         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45831         a_conv.is_owned = false;
45832         LDKTxAbort b_conv;
45833         b_conv.inner = untag_ptr(b);
45834         b_conv.is_owned = ptr_is_owned(b);
45835         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45836         b_conv.is_owned = false;
45837         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
45838         return ret_conv;
45839 }
45840
45841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45842         LDKShutdown this_obj_conv;
45843         this_obj_conv.inner = untag_ptr(this_obj);
45844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45846         Shutdown_free(this_obj_conv);
45847 }
45848
45849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45850         LDKShutdown 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45856         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
45857         return ret_arr;
45858 }
45859
45860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45861         LDKShutdown this_ptr_conv;
45862         this_ptr_conv.inner = untag_ptr(this_ptr);
45863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45865         this_ptr_conv.is_owned = false;
45866         LDKThirtyTwoBytes val_ref;
45867         CHECK((*env)->GetArrayLength(env, val) == 32);
45868         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45869         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
45870 }
45871
45872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
45873         LDKShutdown this_ptr_conv;
45874         this_ptr_conv.inner = untag_ptr(this_ptr);
45875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45877         this_ptr_conv.is_owned = false;
45878         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
45879         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45880         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45881         return ret_arr;
45882 }
45883
45884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45885         LDKShutdown this_ptr_conv;
45886         this_ptr_conv.inner = untag_ptr(this_ptr);
45887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45889         this_ptr_conv.is_owned = false;
45890         LDKCVec_u8Z val_ref;
45891         val_ref.datalen = (*env)->GetArrayLength(env, val);
45892         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45893         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45894         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
45895 }
45896
45897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
45898         LDKThirtyTwoBytes channel_id_arg_ref;
45899         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45900         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45901         LDKCVec_u8Z scriptpubkey_arg_ref;
45902         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
45903         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45904         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
45905         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
45906         int64_t ret_ref = 0;
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45909         return ret_ref;
45910 }
45911
45912 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
45913         LDKShutdown ret_var = Shutdown_clone(arg);
45914         int64_t ret_ref = 0;
45915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45917         return ret_ref;
45918 }
45919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45920         LDKShutdown arg_conv;
45921         arg_conv.inner = untag_ptr(arg);
45922         arg_conv.is_owned = ptr_is_owned(arg);
45923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45924         arg_conv.is_owned = false;
45925         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
45926         return ret_conv;
45927 }
45928
45929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45930         LDKShutdown orig_conv;
45931         orig_conv.inner = untag_ptr(orig);
45932         orig_conv.is_owned = ptr_is_owned(orig);
45933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45934         orig_conv.is_owned = false;
45935         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
45936         int64_t ret_ref = 0;
45937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45939         return ret_ref;
45940 }
45941
45942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45943         LDKShutdown a_conv;
45944         a_conv.inner = untag_ptr(a);
45945         a_conv.is_owned = ptr_is_owned(a);
45946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45947         a_conv.is_owned = false;
45948         LDKShutdown b_conv;
45949         b_conv.inner = untag_ptr(b);
45950         b_conv.is_owned = ptr_is_owned(b);
45951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45952         b_conv.is_owned = false;
45953         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
45954         return ret_conv;
45955 }
45956
45957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45958         LDKClosingSignedFeeRange this_obj_conv;
45959         this_obj_conv.inner = untag_ptr(this_obj);
45960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45962         ClosingSignedFeeRange_free(this_obj_conv);
45963 }
45964
45965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
45966         LDKClosingSignedFeeRange this_ptr_conv;
45967         this_ptr_conv.inner = untag_ptr(this_ptr);
45968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45970         this_ptr_conv.is_owned = false;
45971         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
45972         return ret_conv;
45973 }
45974
45975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45976         LDKClosingSignedFeeRange this_ptr_conv;
45977         this_ptr_conv.inner = untag_ptr(this_ptr);
45978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45980         this_ptr_conv.is_owned = false;
45981         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
45982 }
45983
45984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
45985         LDKClosingSignedFeeRange this_ptr_conv;
45986         this_ptr_conv.inner = untag_ptr(this_ptr);
45987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45989         this_ptr_conv.is_owned = false;
45990         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
45991         return ret_conv;
45992 }
45993
45994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45995         LDKClosingSignedFeeRange this_ptr_conv;
45996         this_ptr_conv.inner = untag_ptr(this_ptr);
45997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45999         this_ptr_conv.is_owned = false;
46000         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
46001 }
46002
46003 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) {
46004         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
46005         int64_t ret_ref = 0;
46006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46008         return ret_ref;
46009 }
46010
46011 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
46012         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
46013         int64_t ret_ref = 0;
46014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46016         return ret_ref;
46017 }
46018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46019         LDKClosingSignedFeeRange arg_conv;
46020         arg_conv.inner = untag_ptr(arg);
46021         arg_conv.is_owned = ptr_is_owned(arg);
46022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46023         arg_conv.is_owned = false;
46024         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
46025         return ret_conv;
46026 }
46027
46028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46029         LDKClosingSignedFeeRange orig_conv;
46030         orig_conv.inner = untag_ptr(orig);
46031         orig_conv.is_owned = ptr_is_owned(orig);
46032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46033         orig_conv.is_owned = false;
46034         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
46035         int64_t ret_ref = 0;
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46038         return ret_ref;
46039 }
46040
46041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46042         LDKClosingSignedFeeRange a_conv;
46043         a_conv.inner = untag_ptr(a);
46044         a_conv.is_owned = ptr_is_owned(a);
46045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46046         a_conv.is_owned = false;
46047         LDKClosingSignedFeeRange b_conv;
46048         b_conv.inner = untag_ptr(b);
46049         b_conv.is_owned = ptr_is_owned(b);
46050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46051         b_conv.is_owned = false;
46052         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
46053         return ret_conv;
46054 }
46055
46056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46057         LDKClosingSigned this_obj_conv;
46058         this_obj_conv.inner = untag_ptr(this_obj);
46059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46061         ClosingSigned_free(this_obj_conv);
46062 }
46063
46064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46065         LDKClosingSigned this_ptr_conv;
46066         this_ptr_conv.inner = untag_ptr(this_ptr);
46067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46069         this_ptr_conv.is_owned = false;
46070         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46071         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
46072         return ret_arr;
46073 }
46074
46075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46076         LDKClosingSigned this_ptr_conv;
46077         this_ptr_conv.inner = untag_ptr(this_ptr);
46078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46080         this_ptr_conv.is_owned = false;
46081         LDKThirtyTwoBytes val_ref;
46082         CHECK((*env)->GetArrayLength(env, val) == 32);
46083         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46084         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
46085 }
46086
46087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46088         LDKClosingSigned this_ptr_conv;
46089         this_ptr_conv.inner = untag_ptr(this_ptr);
46090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46092         this_ptr_conv.is_owned = false;
46093         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
46094         return ret_conv;
46095 }
46096
46097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46098         LDKClosingSigned this_ptr_conv;
46099         this_ptr_conv.inner = untag_ptr(this_ptr);
46100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46102         this_ptr_conv.is_owned = false;
46103         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
46104 }
46105
46106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46107         LDKClosingSigned this_ptr_conv;
46108         this_ptr_conv.inner = untag_ptr(this_ptr);
46109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46111         this_ptr_conv.is_owned = false;
46112         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46113         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
46114         return ret_arr;
46115 }
46116
46117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46118         LDKClosingSigned this_ptr_conv;
46119         this_ptr_conv.inner = untag_ptr(this_ptr);
46120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46122         this_ptr_conv.is_owned = false;
46123         LDKECDSASignature val_ref;
46124         CHECK((*env)->GetArrayLength(env, val) == 64);
46125         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46126         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
46127 }
46128
46129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
46130         LDKClosingSigned this_ptr_conv;
46131         this_ptr_conv.inner = untag_ptr(this_ptr);
46132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46134         this_ptr_conv.is_owned = false;
46135         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
46136         int64_t ret_ref = 0;
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46139         return ret_ref;
46140 }
46141
46142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46143         LDKClosingSigned this_ptr_conv;
46144         this_ptr_conv.inner = untag_ptr(this_ptr);
46145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46147         this_ptr_conv.is_owned = false;
46148         LDKClosingSignedFeeRange val_conv;
46149         val_conv.inner = untag_ptr(val);
46150         val_conv.is_owned = ptr_is_owned(val);
46151         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46152         val_conv = ClosingSignedFeeRange_clone(&val_conv);
46153         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
46154 }
46155
46156 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) {
46157         LDKThirtyTwoBytes channel_id_arg_ref;
46158         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46159         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46160         LDKECDSASignature signature_arg_ref;
46161         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46162         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46163         LDKClosingSignedFeeRange fee_range_arg_conv;
46164         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
46165         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
46166         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
46167         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
46168         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
46169         int64_t ret_ref = 0;
46170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46172         return ret_ref;
46173 }
46174
46175 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
46176         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
46177         int64_t ret_ref = 0;
46178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46180         return ret_ref;
46181 }
46182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46183         LDKClosingSigned arg_conv;
46184         arg_conv.inner = untag_ptr(arg);
46185         arg_conv.is_owned = ptr_is_owned(arg);
46186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46187         arg_conv.is_owned = false;
46188         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
46189         return ret_conv;
46190 }
46191
46192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46193         LDKClosingSigned orig_conv;
46194         orig_conv.inner = untag_ptr(orig);
46195         orig_conv.is_owned = ptr_is_owned(orig);
46196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46197         orig_conv.is_owned = false;
46198         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
46199         int64_t ret_ref = 0;
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46202         return ret_ref;
46203 }
46204
46205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46206         LDKClosingSigned a_conv;
46207         a_conv.inner = untag_ptr(a);
46208         a_conv.is_owned = ptr_is_owned(a);
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46210         a_conv.is_owned = false;
46211         LDKClosingSigned b_conv;
46212         b_conv.inner = untag_ptr(b);
46213         b_conv.is_owned = ptr_is_owned(b);
46214         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46215         b_conv.is_owned = false;
46216         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
46217         return ret_conv;
46218 }
46219
46220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46221         LDKUpdateAddHTLC this_obj_conv;
46222         this_obj_conv.inner = untag_ptr(this_obj);
46223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46225         UpdateAddHTLC_free(this_obj_conv);
46226 }
46227
46228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46229         LDKUpdateAddHTLC this_ptr_conv;
46230         this_ptr_conv.inner = untag_ptr(this_ptr);
46231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46233         this_ptr_conv.is_owned = false;
46234         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46235         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
46236         return ret_arr;
46237 }
46238
46239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46240         LDKUpdateAddHTLC this_ptr_conv;
46241         this_ptr_conv.inner = untag_ptr(this_ptr);
46242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46244         this_ptr_conv.is_owned = false;
46245         LDKThirtyTwoBytes val_ref;
46246         CHECK((*env)->GetArrayLength(env, val) == 32);
46247         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46248         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
46249 }
46250
46251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46252         LDKUpdateAddHTLC this_ptr_conv;
46253         this_ptr_conv.inner = untag_ptr(this_ptr);
46254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46256         this_ptr_conv.is_owned = false;
46257         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46258         return ret_conv;
46259 }
46260
46261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46262         LDKUpdateAddHTLC this_ptr_conv;
46263         this_ptr_conv.inner = untag_ptr(this_ptr);
46264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46266         this_ptr_conv.is_owned = false;
46267         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46268 }
46269
46270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46271         LDKUpdateAddHTLC this_ptr_conv;
46272         this_ptr_conv.inner = untag_ptr(this_ptr);
46273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46275         this_ptr_conv.is_owned = false;
46276         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46277         return ret_conv;
46278 }
46279
46280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46281         LDKUpdateAddHTLC this_ptr_conv;
46282         this_ptr_conv.inner = untag_ptr(this_ptr);
46283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46285         this_ptr_conv.is_owned = false;
46286         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46287 }
46288
46289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46290         LDKUpdateAddHTLC this_ptr_conv;
46291         this_ptr_conv.inner = untag_ptr(this_ptr);
46292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46294         this_ptr_conv.is_owned = false;
46295         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46296         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
46297         return ret_arr;
46298 }
46299
46300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46301         LDKUpdateAddHTLC this_ptr_conv;
46302         this_ptr_conv.inner = untag_ptr(this_ptr);
46303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46305         this_ptr_conv.is_owned = false;
46306         LDKThirtyTwoBytes val_ref;
46307         CHECK((*env)->GetArrayLength(env, val) == 32);
46308         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46309         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46310 }
46311
46312 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
46313         LDKUpdateAddHTLC this_ptr_conv;
46314         this_ptr_conv.inner = untag_ptr(this_ptr);
46315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46317         this_ptr_conv.is_owned = false;
46318         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46319         return ret_conv;
46320 }
46321
46322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46323         LDKUpdateAddHTLC this_ptr_conv;
46324         this_ptr_conv.inner = untag_ptr(this_ptr);
46325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46327         this_ptr_conv.is_owned = false;
46328         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46329 }
46330
46331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46332         LDKUpdateAddHTLC this_ptr_conv;
46333         this_ptr_conv.inner = untag_ptr(this_ptr);
46334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46336         this_ptr_conv.is_owned = false;
46337         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46338         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46339         int64_t ret_ref = tag_ptr(ret_copy, true);
46340         return ret_ref;
46341 }
46342
46343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46344         LDKUpdateAddHTLC this_ptr_conv;
46345         this_ptr_conv.inner = untag_ptr(this_ptr);
46346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46348         this_ptr_conv.is_owned = false;
46349         void* val_ptr = untag_ptr(val);
46350         CHECK_ACCESS(val_ptr);
46351         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46352         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46353         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46354 }
46355
46356 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46357         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46358         int64_t ret_ref = 0;
46359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46361         return ret_ref;
46362 }
46363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46364         LDKUpdateAddHTLC arg_conv;
46365         arg_conv.inner = untag_ptr(arg);
46366         arg_conv.is_owned = ptr_is_owned(arg);
46367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46368         arg_conv.is_owned = false;
46369         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
46370         return ret_conv;
46371 }
46372
46373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46374         LDKUpdateAddHTLC orig_conv;
46375         orig_conv.inner = untag_ptr(orig);
46376         orig_conv.is_owned = ptr_is_owned(orig);
46377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46378         orig_conv.is_owned = false;
46379         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
46380         int64_t ret_ref = 0;
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46383         return ret_ref;
46384 }
46385
46386 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46387         LDKUpdateAddHTLC a_conv;
46388         a_conv.inner = untag_ptr(a);
46389         a_conv.is_owned = ptr_is_owned(a);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46391         a_conv.is_owned = false;
46392         LDKUpdateAddHTLC b_conv;
46393         b_conv.inner = untag_ptr(b);
46394         b_conv.is_owned = ptr_is_owned(b);
46395         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46396         b_conv.is_owned = false;
46397         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
46398         return ret_conv;
46399 }
46400
46401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46402         LDKOnionMessage this_obj_conv;
46403         this_obj_conv.inner = untag_ptr(this_obj);
46404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46406         OnionMessage_free(this_obj_conv);
46407 }
46408
46409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
46410         LDKOnionMessage this_ptr_conv;
46411         this_ptr_conv.inner = untag_ptr(this_ptr);
46412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46414         this_ptr_conv.is_owned = false;
46415         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46416         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
46417         return ret_arr;
46418 }
46419
46420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46421         LDKOnionMessage this_ptr_conv;
46422         this_ptr_conv.inner = untag_ptr(this_ptr);
46423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46425         this_ptr_conv.is_owned = false;
46426         LDKPublicKey val_ref;
46427         CHECK((*env)->GetArrayLength(env, val) == 33);
46428         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46429         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
46430 }
46431
46432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
46433         LDKOnionMessage 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         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
46439         int64_t ret_ref = 0;
46440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46442         return ret_ref;
46443 }
46444
46445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46446         LDKOnionMessage this_ptr_conv;
46447         this_ptr_conv.inner = untag_ptr(this_ptr);
46448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46450         this_ptr_conv.is_owned = false;
46451         LDKPacket val_conv;
46452         val_conv.inner = untag_ptr(val);
46453         val_conv.is_owned = ptr_is_owned(val);
46454         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46455         val_conv = Packet_clone(&val_conv);
46456         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
46457 }
46458
46459 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) {
46460         LDKPublicKey blinding_point_arg_ref;
46461         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
46462         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
46463         LDKPacket onion_routing_packet_arg_conv;
46464         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46465         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46466         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46467         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
46468         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
46469         int64_t ret_ref = 0;
46470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46472         return ret_ref;
46473 }
46474
46475 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
46476         LDKOnionMessage ret_var = OnionMessage_clone(arg);
46477         int64_t ret_ref = 0;
46478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46480         return ret_ref;
46481 }
46482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46483         LDKOnionMessage arg_conv;
46484         arg_conv.inner = untag_ptr(arg);
46485         arg_conv.is_owned = ptr_is_owned(arg);
46486         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46487         arg_conv.is_owned = false;
46488         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
46489         return ret_conv;
46490 }
46491
46492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46493         LDKOnionMessage orig_conv;
46494         orig_conv.inner = untag_ptr(orig);
46495         orig_conv.is_owned = ptr_is_owned(orig);
46496         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46497         orig_conv.is_owned = false;
46498         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
46499         int64_t ret_ref = 0;
46500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46502         return ret_ref;
46503 }
46504
46505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46506         LDKOnionMessage a_conv;
46507         a_conv.inner = untag_ptr(a);
46508         a_conv.is_owned = ptr_is_owned(a);
46509         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46510         a_conv.is_owned = false;
46511         LDKOnionMessage b_conv;
46512         b_conv.inner = untag_ptr(b);
46513         b_conv.is_owned = ptr_is_owned(b);
46514         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46515         b_conv.is_owned = false;
46516         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
46517         return ret_conv;
46518 }
46519
46520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46521         LDKUpdateFulfillHTLC this_obj_conv;
46522         this_obj_conv.inner = untag_ptr(this_obj);
46523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46525         UpdateFulfillHTLC_free(this_obj_conv);
46526 }
46527
46528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46529         LDKUpdateFulfillHTLC this_ptr_conv;
46530         this_ptr_conv.inner = untag_ptr(this_ptr);
46531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46533         this_ptr_conv.is_owned = false;
46534         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46535         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
46536         return ret_arr;
46537 }
46538
46539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46540         LDKUpdateFulfillHTLC this_ptr_conv;
46541         this_ptr_conv.inner = untag_ptr(this_ptr);
46542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46544         this_ptr_conv.is_owned = false;
46545         LDKThirtyTwoBytes val_ref;
46546         CHECK((*env)->GetArrayLength(env, val) == 32);
46547         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46548         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
46549 }
46550
46551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46552         LDKUpdateFulfillHTLC this_ptr_conv;
46553         this_ptr_conv.inner = untag_ptr(this_ptr);
46554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46556         this_ptr_conv.is_owned = false;
46557         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
46558         return ret_conv;
46559 }
46560
46561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46562         LDKUpdateFulfillHTLC this_ptr_conv;
46563         this_ptr_conv.inner = untag_ptr(this_ptr);
46564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46566         this_ptr_conv.is_owned = false;
46567         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
46568 }
46569
46570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
46571         LDKUpdateFulfillHTLC this_ptr_conv;
46572         this_ptr_conv.inner = untag_ptr(this_ptr);
46573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46575         this_ptr_conv.is_owned = false;
46576         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46577         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
46578         return ret_arr;
46579 }
46580
46581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46582         LDKUpdateFulfillHTLC this_ptr_conv;
46583         this_ptr_conv.inner = untag_ptr(this_ptr);
46584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46586         this_ptr_conv.is_owned = false;
46587         LDKThirtyTwoBytes val_ref;
46588         CHECK((*env)->GetArrayLength(env, val) == 32);
46589         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46590         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
46591 }
46592
46593 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) {
46594         LDKThirtyTwoBytes channel_id_arg_ref;
46595         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46596         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46597         LDKThirtyTwoBytes payment_preimage_arg_ref;
46598         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
46599         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
46600         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
46601         int64_t ret_ref = 0;
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46604         return ret_ref;
46605 }
46606
46607 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
46608         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
46609         int64_t ret_ref = 0;
46610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46612         return ret_ref;
46613 }
46614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46615         LDKUpdateFulfillHTLC arg_conv;
46616         arg_conv.inner = untag_ptr(arg);
46617         arg_conv.is_owned = ptr_is_owned(arg);
46618         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46619         arg_conv.is_owned = false;
46620         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
46621         return ret_conv;
46622 }
46623
46624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46625         LDKUpdateFulfillHTLC orig_conv;
46626         orig_conv.inner = untag_ptr(orig);
46627         orig_conv.is_owned = ptr_is_owned(orig);
46628         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46629         orig_conv.is_owned = false;
46630         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
46631         int64_t ret_ref = 0;
46632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46634         return ret_ref;
46635 }
46636
46637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46638         LDKUpdateFulfillHTLC a_conv;
46639         a_conv.inner = untag_ptr(a);
46640         a_conv.is_owned = ptr_is_owned(a);
46641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46642         a_conv.is_owned = false;
46643         LDKUpdateFulfillHTLC b_conv;
46644         b_conv.inner = untag_ptr(b);
46645         b_conv.is_owned = ptr_is_owned(b);
46646         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46647         b_conv.is_owned = false;
46648         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
46649         return ret_conv;
46650 }
46651
46652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46653         LDKUpdateFailHTLC this_obj_conv;
46654         this_obj_conv.inner = untag_ptr(this_obj);
46655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46657         UpdateFailHTLC_free(this_obj_conv);
46658 }
46659
46660 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46661         LDKUpdateFailHTLC this_ptr_conv;
46662         this_ptr_conv.inner = untag_ptr(this_ptr);
46663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46665         this_ptr_conv.is_owned = false;
46666         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46667         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
46668         return ret_arr;
46669 }
46670
46671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46672         LDKUpdateFailHTLC this_ptr_conv;
46673         this_ptr_conv.inner = untag_ptr(this_ptr);
46674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46676         this_ptr_conv.is_owned = false;
46677         LDKThirtyTwoBytes val_ref;
46678         CHECK((*env)->GetArrayLength(env, val) == 32);
46679         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46680         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
46681 }
46682
46683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46684         LDKUpdateFailHTLC this_ptr_conv;
46685         this_ptr_conv.inner = untag_ptr(this_ptr);
46686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46688         this_ptr_conv.is_owned = false;
46689         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
46690         return ret_conv;
46691 }
46692
46693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46694         LDKUpdateFailHTLC this_ptr_conv;
46695         this_ptr_conv.inner = untag_ptr(this_ptr);
46696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46698         this_ptr_conv.is_owned = false;
46699         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
46700 }
46701
46702 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
46703         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
46704         int64_t ret_ref = 0;
46705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46707         return ret_ref;
46708 }
46709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46710         LDKUpdateFailHTLC arg_conv;
46711         arg_conv.inner = untag_ptr(arg);
46712         arg_conv.is_owned = ptr_is_owned(arg);
46713         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46714         arg_conv.is_owned = false;
46715         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
46716         return ret_conv;
46717 }
46718
46719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46720         LDKUpdateFailHTLC orig_conv;
46721         orig_conv.inner = untag_ptr(orig);
46722         orig_conv.is_owned = ptr_is_owned(orig);
46723         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46724         orig_conv.is_owned = false;
46725         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
46726         int64_t ret_ref = 0;
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46729         return ret_ref;
46730 }
46731
46732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46733         LDKUpdateFailHTLC a_conv;
46734         a_conv.inner = untag_ptr(a);
46735         a_conv.is_owned = ptr_is_owned(a);
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46737         a_conv.is_owned = false;
46738         LDKUpdateFailHTLC b_conv;
46739         b_conv.inner = untag_ptr(b);
46740         b_conv.is_owned = ptr_is_owned(b);
46741         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46742         b_conv.is_owned = false;
46743         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
46744         return ret_conv;
46745 }
46746
46747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46748         LDKUpdateFailMalformedHTLC this_obj_conv;
46749         this_obj_conv.inner = untag_ptr(this_obj);
46750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46752         UpdateFailMalformedHTLC_free(this_obj_conv);
46753 }
46754
46755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46756         LDKUpdateFailMalformedHTLC this_ptr_conv;
46757         this_ptr_conv.inner = untag_ptr(this_ptr);
46758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46760         this_ptr_conv.is_owned = false;
46761         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46762         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
46763         return ret_arr;
46764 }
46765
46766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46767         LDKUpdateFailMalformedHTLC this_ptr_conv;
46768         this_ptr_conv.inner = untag_ptr(this_ptr);
46769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46771         this_ptr_conv.is_owned = false;
46772         LDKThirtyTwoBytes val_ref;
46773         CHECK((*env)->GetArrayLength(env, val) == 32);
46774         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46775         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
46776 }
46777
46778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46779         LDKUpdateFailMalformedHTLC this_ptr_conv;
46780         this_ptr_conv.inner = untag_ptr(this_ptr);
46781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46783         this_ptr_conv.is_owned = false;
46784         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
46785         return ret_conv;
46786 }
46787
46788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46789         LDKUpdateFailMalformedHTLC this_ptr_conv;
46790         this_ptr_conv.inner = untag_ptr(this_ptr);
46791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46793         this_ptr_conv.is_owned = false;
46794         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
46795 }
46796
46797 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
46798         LDKUpdateFailMalformedHTLC this_ptr_conv;
46799         this_ptr_conv.inner = untag_ptr(this_ptr);
46800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46802         this_ptr_conv.is_owned = false;
46803         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
46804         return ret_conv;
46805 }
46806
46807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46808         LDKUpdateFailMalformedHTLC this_ptr_conv;
46809         this_ptr_conv.inner = untag_ptr(this_ptr);
46810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46812         this_ptr_conv.is_owned = false;
46813         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
46814 }
46815
46816 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
46817         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
46818         int64_t ret_ref = 0;
46819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46821         return ret_ref;
46822 }
46823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46824         LDKUpdateFailMalformedHTLC arg_conv;
46825         arg_conv.inner = untag_ptr(arg);
46826         arg_conv.is_owned = ptr_is_owned(arg);
46827         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46828         arg_conv.is_owned = false;
46829         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
46830         return ret_conv;
46831 }
46832
46833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46834         LDKUpdateFailMalformedHTLC orig_conv;
46835         orig_conv.inner = untag_ptr(orig);
46836         orig_conv.is_owned = ptr_is_owned(orig);
46837         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46838         orig_conv.is_owned = false;
46839         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
46840         int64_t ret_ref = 0;
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46843         return ret_ref;
46844 }
46845
46846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46847         LDKUpdateFailMalformedHTLC a_conv;
46848         a_conv.inner = untag_ptr(a);
46849         a_conv.is_owned = ptr_is_owned(a);
46850         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46851         a_conv.is_owned = false;
46852         LDKUpdateFailMalformedHTLC b_conv;
46853         b_conv.inner = untag_ptr(b);
46854         b_conv.is_owned = ptr_is_owned(b);
46855         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46856         b_conv.is_owned = false;
46857         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
46858         return ret_conv;
46859 }
46860
46861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46862         LDKCommitmentSigned this_obj_conv;
46863         this_obj_conv.inner = untag_ptr(this_obj);
46864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46866         CommitmentSigned_free(this_obj_conv);
46867 }
46868
46869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46870         LDKCommitmentSigned this_ptr_conv;
46871         this_ptr_conv.inner = untag_ptr(this_ptr);
46872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46874         this_ptr_conv.is_owned = false;
46875         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46876         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
46877         return ret_arr;
46878 }
46879
46880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46881         LDKCommitmentSigned this_ptr_conv;
46882         this_ptr_conv.inner = untag_ptr(this_ptr);
46883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46885         this_ptr_conv.is_owned = false;
46886         LDKThirtyTwoBytes val_ref;
46887         CHECK((*env)->GetArrayLength(env, val) == 32);
46888         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46889         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
46890 }
46891
46892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46893         LDKCommitmentSigned this_ptr_conv;
46894         this_ptr_conv.inner = untag_ptr(this_ptr);
46895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46897         this_ptr_conv.is_owned = false;
46898         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46899         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
46900         return ret_arr;
46901 }
46902
46903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46904         LDKCommitmentSigned this_ptr_conv;
46905         this_ptr_conv.inner = untag_ptr(this_ptr);
46906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46908         this_ptr_conv.is_owned = false;
46909         LDKECDSASignature val_ref;
46910         CHECK((*env)->GetArrayLength(env, val) == 64);
46911         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46912         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
46913 }
46914
46915 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
46916         LDKCommitmentSigned this_ptr_conv;
46917         this_ptr_conv.inner = untag_ptr(this_ptr);
46918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46920         this_ptr_conv.is_owned = false;
46921         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
46922         jobjectArray ret_arr = NULL;
46923         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
46924         ;
46925         for (size_t i = 0; i < ret_var.datalen; i++) {
46926                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
46927                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
46928                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
46929         }
46930         
46931         FREE(ret_var.data);
46932         return ret_arr;
46933 }
46934
46935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
46936         LDKCommitmentSigned this_ptr_conv;
46937         this_ptr_conv.inner = untag_ptr(this_ptr);
46938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46940         this_ptr_conv.is_owned = false;
46941         LDKCVec_ECDSASignatureZ val_constr;
46942         val_constr.datalen = (*env)->GetArrayLength(env, val);
46943         if (val_constr.datalen > 0)
46944                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46945         else
46946                 val_constr.data = NULL;
46947         for (size_t i = 0; i < val_constr.datalen; i++) {
46948                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
46949                 LDKECDSASignature val_conv_8_ref;
46950                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
46951                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
46952                 val_constr.data[i] = val_conv_8_ref;
46953         }
46954         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
46955 }
46956
46957 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) {
46958         LDKThirtyTwoBytes channel_id_arg_ref;
46959         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46960         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46961         LDKECDSASignature signature_arg_ref;
46962         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46963         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46964         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
46965         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
46966         if (htlc_signatures_arg_constr.datalen > 0)
46967                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46968         else
46969                 htlc_signatures_arg_constr.data = NULL;
46970         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
46971                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
46972                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
46973                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
46974                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
46975                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
46976         }
46977         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
46978         int64_t ret_ref = 0;
46979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46981         return ret_ref;
46982 }
46983
46984 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
46985         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
46986         int64_t ret_ref = 0;
46987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46989         return ret_ref;
46990 }
46991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46992         LDKCommitmentSigned arg_conv;
46993         arg_conv.inner = untag_ptr(arg);
46994         arg_conv.is_owned = ptr_is_owned(arg);
46995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46996         arg_conv.is_owned = false;
46997         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
46998         return ret_conv;
46999 }
47000
47001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47002         LDKCommitmentSigned orig_conv;
47003         orig_conv.inner = untag_ptr(orig);
47004         orig_conv.is_owned = ptr_is_owned(orig);
47005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47006         orig_conv.is_owned = false;
47007         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
47008         int64_t ret_ref = 0;
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47011         return ret_ref;
47012 }
47013
47014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47015         LDKCommitmentSigned a_conv;
47016         a_conv.inner = untag_ptr(a);
47017         a_conv.is_owned = ptr_is_owned(a);
47018         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47019         a_conv.is_owned = false;
47020         LDKCommitmentSigned b_conv;
47021         b_conv.inner = untag_ptr(b);
47022         b_conv.is_owned = ptr_is_owned(b);
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47024         b_conv.is_owned = false;
47025         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
47026         return ret_conv;
47027 }
47028
47029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47030         LDKRevokeAndACK this_obj_conv;
47031         this_obj_conv.inner = untag_ptr(this_obj);
47032         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47034         RevokeAndACK_free(this_obj_conv);
47035 }
47036
47037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47038         LDKRevokeAndACK this_ptr_conv;
47039         this_ptr_conv.inner = untag_ptr(this_ptr);
47040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47042         this_ptr_conv.is_owned = false;
47043         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47044         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
47045         return ret_arr;
47046 }
47047
47048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47049         LDKRevokeAndACK this_ptr_conv;
47050         this_ptr_conv.inner = untag_ptr(this_ptr);
47051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47053         this_ptr_conv.is_owned = false;
47054         LDKThirtyTwoBytes val_ref;
47055         CHECK((*env)->GetArrayLength(env, val) == 32);
47056         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47057         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
47058 }
47059
47060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47061         LDKRevokeAndACK 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47067         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
47068         return ret_arr;
47069 }
47070
47071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47072         LDKRevokeAndACK this_ptr_conv;
47073         this_ptr_conv.inner = untag_ptr(this_ptr);
47074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47076         this_ptr_conv.is_owned = false;
47077         LDKThirtyTwoBytes val_ref;
47078         CHECK((*env)->GetArrayLength(env, val) == 32);
47079         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47080         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
47081 }
47082
47083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47084         LDKRevokeAndACK this_ptr_conv;
47085         this_ptr_conv.inner = untag_ptr(this_ptr);
47086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47088         this_ptr_conv.is_owned = false;
47089         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47090         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
47091         return ret_arr;
47092 }
47093
47094 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) {
47095         LDKRevokeAndACK this_ptr_conv;
47096         this_ptr_conv.inner = untag_ptr(this_ptr);
47097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47099         this_ptr_conv.is_owned = false;
47100         LDKPublicKey val_ref;
47101         CHECK((*env)->GetArrayLength(env, val) == 33);
47102         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47103         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47104 }
47105
47106 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) {
47107         LDKThirtyTwoBytes channel_id_arg_ref;
47108         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47109         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47110         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
47111         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
47112         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
47113         LDKPublicKey next_per_commitment_point_arg_ref;
47114         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
47115         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
47116         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47117         int64_t ret_ref = 0;
47118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47120         return ret_ref;
47121 }
47122
47123 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47124         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47125         int64_t ret_ref = 0;
47126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47128         return ret_ref;
47129 }
47130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47131         LDKRevokeAndACK arg_conv;
47132         arg_conv.inner = untag_ptr(arg);
47133         arg_conv.is_owned = ptr_is_owned(arg);
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47135         arg_conv.is_owned = false;
47136         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47137         return ret_conv;
47138 }
47139
47140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47141         LDKRevokeAndACK orig_conv;
47142         orig_conv.inner = untag_ptr(orig);
47143         orig_conv.is_owned = ptr_is_owned(orig);
47144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47145         orig_conv.is_owned = false;
47146         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47147         int64_t ret_ref = 0;
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47150         return ret_ref;
47151 }
47152
47153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47154         LDKRevokeAndACK a_conv;
47155         a_conv.inner = untag_ptr(a);
47156         a_conv.is_owned = ptr_is_owned(a);
47157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47158         a_conv.is_owned = false;
47159         LDKRevokeAndACK b_conv;
47160         b_conv.inner = untag_ptr(b);
47161         b_conv.is_owned = ptr_is_owned(b);
47162         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47163         b_conv.is_owned = false;
47164         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47165         return ret_conv;
47166 }
47167
47168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47169         LDKUpdateFee this_obj_conv;
47170         this_obj_conv.inner = untag_ptr(this_obj);
47171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47173         UpdateFee_free(this_obj_conv);
47174 }
47175
47176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47177         LDKUpdateFee this_ptr_conv;
47178         this_ptr_conv.inner = untag_ptr(this_ptr);
47179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47181         this_ptr_conv.is_owned = false;
47182         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47183         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
47184         return ret_arr;
47185 }
47186
47187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47188         LDKUpdateFee this_ptr_conv;
47189         this_ptr_conv.inner = untag_ptr(this_ptr);
47190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47192         this_ptr_conv.is_owned = false;
47193         LDKThirtyTwoBytes val_ref;
47194         CHECK((*env)->GetArrayLength(env, val) == 32);
47195         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47196         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47197 }
47198
47199 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
47200         LDKUpdateFee this_ptr_conv;
47201         this_ptr_conv.inner = untag_ptr(this_ptr);
47202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47204         this_ptr_conv.is_owned = false;
47205         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47206         return ret_conv;
47207 }
47208
47209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47210         LDKUpdateFee this_ptr_conv;
47211         this_ptr_conv.inner = untag_ptr(this_ptr);
47212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47214         this_ptr_conv.is_owned = false;
47215         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47216 }
47217
47218 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) {
47219         LDKThirtyTwoBytes channel_id_arg_ref;
47220         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47221         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47222         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47223         int64_t ret_ref = 0;
47224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47226         return ret_ref;
47227 }
47228
47229 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47230         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47231         int64_t ret_ref = 0;
47232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47234         return ret_ref;
47235 }
47236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47237         LDKUpdateFee arg_conv;
47238         arg_conv.inner = untag_ptr(arg);
47239         arg_conv.is_owned = ptr_is_owned(arg);
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47241         arg_conv.is_owned = false;
47242         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47243         return ret_conv;
47244 }
47245
47246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47247         LDKUpdateFee orig_conv;
47248         orig_conv.inner = untag_ptr(orig);
47249         orig_conv.is_owned = ptr_is_owned(orig);
47250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47251         orig_conv.is_owned = false;
47252         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47253         int64_t ret_ref = 0;
47254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47256         return ret_ref;
47257 }
47258
47259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47260         LDKUpdateFee a_conv;
47261         a_conv.inner = untag_ptr(a);
47262         a_conv.is_owned = ptr_is_owned(a);
47263         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47264         a_conv.is_owned = false;
47265         LDKUpdateFee b_conv;
47266         b_conv.inner = untag_ptr(b);
47267         b_conv.is_owned = ptr_is_owned(b);
47268         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47269         b_conv.is_owned = false;
47270         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47271         return ret_conv;
47272 }
47273
47274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47275         LDKChannelReestablish this_obj_conv;
47276         this_obj_conv.inner = untag_ptr(this_obj);
47277         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47279         ChannelReestablish_free(this_obj_conv);
47280 }
47281
47282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47283         LDKChannelReestablish this_ptr_conv;
47284         this_ptr_conv.inner = untag_ptr(this_ptr);
47285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47287         this_ptr_conv.is_owned = false;
47288         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47289         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
47290         return ret_arr;
47291 }
47292
47293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47294         LDKChannelReestablish this_ptr_conv;
47295         this_ptr_conv.inner = untag_ptr(this_ptr);
47296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47298         this_ptr_conv.is_owned = false;
47299         LDKThirtyTwoBytes val_ref;
47300         CHECK((*env)->GetArrayLength(env, val) == 32);
47301         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47302         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47303 }
47304
47305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47306         LDKChannelReestablish this_ptr_conv;
47307         this_ptr_conv.inner = untag_ptr(this_ptr);
47308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47310         this_ptr_conv.is_owned = false;
47311         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47312         return ret_conv;
47313 }
47314
47315 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) {
47316         LDKChannelReestablish this_ptr_conv;
47317         this_ptr_conv.inner = untag_ptr(this_ptr);
47318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47320         this_ptr_conv.is_owned = false;
47321         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47322 }
47323
47324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47325         LDKChannelReestablish this_ptr_conv;
47326         this_ptr_conv.inner = untag_ptr(this_ptr);
47327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47329         this_ptr_conv.is_owned = false;
47330         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47331         return ret_conv;
47332 }
47333
47334 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) {
47335         LDKChannelReestablish this_ptr_conv;
47336         this_ptr_conv.inner = untag_ptr(this_ptr);
47337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47339         this_ptr_conv.is_owned = false;
47340         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47341 }
47342
47343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47344         LDKChannelReestablish this_ptr_conv;
47345         this_ptr_conv.inner = untag_ptr(this_ptr);
47346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47348         this_ptr_conv.is_owned = false;
47349         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47350         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
47351         return ret_arr;
47352 }
47353
47354 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) {
47355         LDKChannelReestablish this_ptr_conv;
47356         this_ptr_conv.inner = untag_ptr(this_ptr);
47357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47359         this_ptr_conv.is_owned = false;
47360         LDKThirtyTwoBytes val_ref;
47361         CHECK((*env)->GetArrayLength(env, val) == 32);
47362         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47363         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47364 }
47365
47366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47367         LDKChannelReestablish this_ptr_conv;
47368         this_ptr_conv.inner = untag_ptr(this_ptr);
47369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47371         this_ptr_conv.is_owned = false;
47372         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
47374         return ret_arr;
47375 }
47376
47377 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) {
47378         LDKChannelReestablish this_ptr_conv;
47379         this_ptr_conv.inner = untag_ptr(this_ptr);
47380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47382         this_ptr_conv.is_owned = false;
47383         LDKPublicKey val_ref;
47384         CHECK((*env)->GetArrayLength(env, val) == 33);
47385         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47386         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
47387 }
47388
47389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
47390         LDKChannelReestablish this_ptr_conv;
47391         this_ptr_conv.inner = untag_ptr(this_ptr);
47392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47394         this_ptr_conv.is_owned = false;
47395         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
47396         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
47397         int64_t ret_ref = tag_ptr(ret_copy, true);
47398         return ret_ref;
47399 }
47400
47401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47402         LDKChannelReestablish 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         void* val_ptr = untag_ptr(val);
47408         CHECK_ACCESS(val_ptr);
47409         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
47410         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
47411         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
47412 }
47413
47414 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) {
47415         LDKThirtyTwoBytes channel_id_arg_ref;
47416         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47417         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47418         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
47419         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
47420         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
47421         LDKPublicKey my_current_per_commitment_point_arg_ref;
47422         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
47423         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
47424         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
47425         CHECK_ACCESS(next_funding_txid_arg_ptr);
47426         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
47427         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
47428         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);
47429         int64_t ret_ref = 0;
47430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47432         return ret_ref;
47433 }
47434
47435 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
47436         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
47437         int64_t ret_ref = 0;
47438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47440         return ret_ref;
47441 }
47442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47443         LDKChannelReestablish arg_conv;
47444         arg_conv.inner = untag_ptr(arg);
47445         arg_conv.is_owned = ptr_is_owned(arg);
47446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47447         arg_conv.is_owned = false;
47448         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
47449         return ret_conv;
47450 }
47451
47452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47453         LDKChannelReestablish orig_conv;
47454         orig_conv.inner = untag_ptr(orig);
47455         orig_conv.is_owned = ptr_is_owned(orig);
47456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47457         orig_conv.is_owned = false;
47458         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
47459         int64_t ret_ref = 0;
47460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47462         return ret_ref;
47463 }
47464
47465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47466         LDKChannelReestablish a_conv;
47467         a_conv.inner = untag_ptr(a);
47468         a_conv.is_owned = ptr_is_owned(a);
47469         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47470         a_conv.is_owned = false;
47471         LDKChannelReestablish b_conv;
47472         b_conv.inner = untag_ptr(b);
47473         b_conv.is_owned = ptr_is_owned(b);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47475         b_conv.is_owned = false;
47476         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
47477         return ret_conv;
47478 }
47479
47480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47481         LDKAnnouncementSignatures this_obj_conv;
47482         this_obj_conv.inner = untag_ptr(this_obj);
47483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47485         AnnouncementSignatures_free(this_obj_conv);
47486 }
47487
47488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47489         LDKAnnouncementSignatures this_ptr_conv;
47490         this_ptr_conv.inner = untag_ptr(this_ptr);
47491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47493         this_ptr_conv.is_owned = false;
47494         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47495         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
47496         return ret_arr;
47497 }
47498
47499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47500         LDKAnnouncementSignatures this_ptr_conv;
47501         this_ptr_conv.inner = untag_ptr(this_ptr);
47502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47504         this_ptr_conv.is_owned = false;
47505         LDKThirtyTwoBytes val_ref;
47506         CHECK((*env)->GetArrayLength(env, val) == 32);
47507         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47508         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
47509 }
47510
47511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47512         LDKAnnouncementSignatures this_ptr_conv;
47513         this_ptr_conv.inner = untag_ptr(this_ptr);
47514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47516         this_ptr_conv.is_owned = false;
47517         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
47518         return ret_conv;
47519 }
47520
47521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47522         LDKAnnouncementSignatures this_ptr_conv;
47523         this_ptr_conv.inner = untag_ptr(this_ptr);
47524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47526         this_ptr_conv.is_owned = false;
47527         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
47528 }
47529
47530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
47531         LDKAnnouncementSignatures this_ptr_conv;
47532         this_ptr_conv.inner = untag_ptr(this_ptr);
47533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47535         this_ptr_conv.is_owned = false;
47536         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
47537         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
47538         return ret_arr;
47539 }
47540
47541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47542         LDKAnnouncementSignatures this_ptr_conv;
47543         this_ptr_conv.inner = untag_ptr(this_ptr);
47544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47546         this_ptr_conv.is_owned = false;
47547         LDKECDSASignature val_ref;
47548         CHECK((*env)->GetArrayLength(env, val) == 64);
47549         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
47550         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
47551 }
47552
47553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
47554         LDKAnnouncementSignatures this_ptr_conv;
47555         this_ptr_conv.inner = untag_ptr(this_ptr);
47556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47558         this_ptr_conv.is_owned = false;
47559         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
47560         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
47561         return ret_arr;
47562 }
47563
47564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47565         LDKAnnouncementSignatures this_ptr_conv;
47566         this_ptr_conv.inner = untag_ptr(this_ptr);
47567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47569         this_ptr_conv.is_owned = false;
47570         LDKECDSASignature val_ref;
47571         CHECK((*env)->GetArrayLength(env, val) == 64);
47572         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
47573         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
47574 }
47575
47576 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) {
47577         LDKThirtyTwoBytes channel_id_arg_ref;
47578         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47579         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47580         LDKECDSASignature node_signature_arg_ref;
47581         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
47582         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
47583         LDKECDSASignature bitcoin_signature_arg_ref;
47584         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
47585         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
47586         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
47587         int64_t ret_ref = 0;
47588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47590         return ret_ref;
47591 }
47592
47593 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
47594         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
47595         int64_t ret_ref = 0;
47596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47598         return ret_ref;
47599 }
47600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47601         LDKAnnouncementSignatures arg_conv;
47602         arg_conv.inner = untag_ptr(arg);
47603         arg_conv.is_owned = ptr_is_owned(arg);
47604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47605         arg_conv.is_owned = false;
47606         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
47607         return ret_conv;
47608 }
47609
47610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47611         LDKAnnouncementSignatures orig_conv;
47612         orig_conv.inner = untag_ptr(orig);
47613         orig_conv.is_owned = ptr_is_owned(orig);
47614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47615         orig_conv.is_owned = false;
47616         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
47617         int64_t ret_ref = 0;
47618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47620         return ret_ref;
47621 }
47622
47623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47624         LDKAnnouncementSignatures a_conv;
47625         a_conv.inner = untag_ptr(a);
47626         a_conv.is_owned = ptr_is_owned(a);
47627         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47628         a_conv.is_owned = false;
47629         LDKAnnouncementSignatures b_conv;
47630         b_conv.inner = untag_ptr(b);
47631         b_conv.is_owned = ptr_is_owned(b);
47632         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47633         b_conv.is_owned = false;
47634         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
47635         return ret_conv;
47636 }
47637
47638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47639         if (!ptr_is_owned(this_ptr)) return;
47640         void* this_ptr_ptr = untag_ptr(this_ptr);
47641         CHECK_ACCESS(this_ptr_ptr);
47642         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
47643         FREE(untag_ptr(this_ptr));
47644         SocketAddress_free(this_ptr_conv);
47645 }
47646
47647 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
47648         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47649         *ret_copy = SocketAddress_clone(arg);
47650         int64_t ret_ref = tag_ptr(ret_copy, true);
47651         return ret_ref;
47652 }
47653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47654         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
47655         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
47656         return ret_conv;
47657 }
47658
47659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47660         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
47661         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47662         *ret_copy = SocketAddress_clone(orig_conv);
47663         int64_t ret_ref = tag_ptr(ret_copy, true);
47664         return ret_ref;
47665 }
47666
47667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
47668         LDKFourBytes addr_ref;
47669         CHECK((*env)->GetArrayLength(env, addr) == 4);
47670         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
47671         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47672         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
47673         int64_t ret_ref = tag_ptr(ret_copy, true);
47674         return ret_ref;
47675 }
47676
47677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
47678         LDKSixteenBytes addr_ref;
47679         CHECK((*env)->GetArrayLength(env, addr) == 16);
47680         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
47681         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47682         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
47683         int64_t ret_ref = tag_ptr(ret_copy, true);
47684         return ret_ref;
47685 }
47686
47687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
47688         LDKTwelveBytes a_ref;
47689         CHECK((*env)->GetArrayLength(env, a) == 12);
47690         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
47691         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47692         *ret_copy = SocketAddress_onion_v2(a_ref);
47693         int64_t ret_ref = tag_ptr(ret_copy, true);
47694         return ret_ref;
47695 }
47696
47697 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) {
47698         LDKThirtyTwoBytes ed25519_pubkey_ref;
47699         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
47700         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
47701         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47702         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
47703         int64_t ret_ref = tag_ptr(ret_copy, true);
47704         return ret_ref;
47705 }
47706
47707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
47708         LDKHostname hostname_conv;
47709         hostname_conv.inner = untag_ptr(hostname);
47710         hostname_conv.is_owned = ptr_is_owned(hostname);
47711         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
47712         hostname_conv = Hostname_clone(&hostname_conv);
47713         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47714         *ret_copy = SocketAddress_hostname(hostname_conv, port);
47715         int64_t ret_ref = tag_ptr(ret_copy, true);
47716         return ret_ref;
47717 }
47718
47719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47720         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
47721         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
47722         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
47723         return ret_conv;
47724 }
47725
47726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
47727         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
47728         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
47729         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47730         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47731         CVec_u8Z_free(ret_var);
47732         return ret_arr;
47733 }
47734
47735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47736         LDKu8slice ser_ref;
47737         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47738         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47739         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
47740         *ret_conv = SocketAddress_read(ser_ref);
47741         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47742         return tag_ptr(ret_conv, true);
47743 }
47744
47745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47746         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
47747         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
47748         return ret_conv;
47749 }
47750
47751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
47752         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
47753         return ret_conv;
47754 }
47755
47756 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
47757         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
47758         return ret_conv;
47759 }
47760
47761 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
47762         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
47763         return ret_conv;
47764 }
47765
47766 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
47767         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
47768         return ret_conv;
47769 }
47770
47771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47772         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
47773         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
47774         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
47775         return ret_conv;
47776 }
47777
47778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
47779         LDKStr host_conv = java_to_owned_str(env, host);
47780         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
47781         *ret_conv = parse_onion_address(host_conv, port);
47782         return tag_ptr(ret_conv, true);
47783 }
47784
47785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
47786         LDKStr s_conv = java_to_owned_str(env, s);
47787         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
47788         *ret_conv = SocketAddress_from_str(s_conv);
47789         return tag_ptr(ret_conv, true);
47790 }
47791
47792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47793         if (!ptr_is_owned(this_ptr)) return;
47794         void* this_ptr_ptr = untag_ptr(this_ptr);
47795         CHECK_ACCESS(this_ptr_ptr);
47796         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
47797         FREE(untag_ptr(this_ptr));
47798         UnsignedGossipMessage_free(this_ptr_conv);
47799 }
47800
47801 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
47802         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47803         *ret_copy = UnsignedGossipMessage_clone(arg);
47804         int64_t ret_ref = tag_ptr(ret_copy, true);
47805         return ret_ref;
47806 }
47807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47808         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
47809         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
47810         return ret_conv;
47811 }
47812
47813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47814         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
47815         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47816         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
47817         int64_t ret_ref = tag_ptr(ret_copy, true);
47818         return ret_ref;
47819 }
47820
47821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
47822         LDKUnsignedChannelAnnouncement a_conv;
47823         a_conv.inner = untag_ptr(a);
47824         a_conv.is_owned = ptr_is_owned(a);
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47826         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
47827         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47828         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
47829         int64_t ret_ref = tag_ptr(ret_copy, true);
47830         return ret_ref;
47831 }
47832
47833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
47834         LDKUnsignedChannelUpdate a_conv;
47835         a_conv.inner = untag_ptr(a);
47836         a_conv.is_owned = ptr_is_owned(a);
47837         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47838         a_conv = UnsignedChannelUpdate_clone(&a_conv);
47839         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47840         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
47841         int64_t ret_ref = tag_ptr(ret_copy, true);
47842         return ret_ref;
47843 }
47844
47845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
47846         LDKUnsignedNodeAnnouncement a_conv;
47847         a_conv.inner = untag_ptr(a);
47848         a_conv.is_owned = ptr_is_owned(a);
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47850         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
47851         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47852         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
47853         int64_t ret_ref = tag_ptr(ret_copy, true);
47854         return ret_ref;
47855 }
47856
47857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
47858         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
47859         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
47860         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47861         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47862         CVec_u8Z_free(ret_var);
47863         return ret_arr;
47864 }
47865
47866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47867         LDKUnsignedNodeAnnouncement this_obj_conv;
47868         this_obj_conv.inner = untag_ptr(this_obj);
47869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47871         UnsignedNodeAnnouncement_free(this_obj_conv);
47872 }
47873
47874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
47875         LDKUnsignedNodeAnnouncement this_ptr_conv;
47876         this_ptr_conv.inner = untag_ptr(this_ptr);
47877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47879         this_ptr_conv.is_owned = false;
47880         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
47881         int64_t ret_ref = 0;
47882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47884         return ret_ref;
47885 }
47886
47887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47888         LDKUnsignedNodeAnnouncement this_ptr_conv;
47889         this_ptr_conv.inner = untag_ptr(this_ptr);
47890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47892         this_ptr_conv.is_owned = false;
47893         LDKNodeFeatures val_conv;
47894         val_conv.inner = untag_ptr(val);
47895         val_conv.is_owned = ptr_is_owned(val);
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47897         val_conv = NodeFeatures_clone(&val_conv);
47898         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
47899 }
47900
47901 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
47902         LDKUnsignedNodeAnnouncement this_ptr_conv;
47903         this_ptr_conv.inner = untag_ptr(this_ptr);
47904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47906         this_ptr_conv.is_owned = false;
47907         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
47908         return ret_conv;
47909 }
47910
47911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47912         LDKUnsignedNodeAnnouncement this_ptr_conv;
47913         this_ptr_conv.inner = untag_ptr(this_ptr);
47914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47916         this_ptr_conv.is_owned = false;
47917         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
47918 }
47919
47920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47921         LDKUnsignedNodeAnnouncement this_ptr_conv;
47922         this_ptr_conv.inner = untag_ptr(this_ptr);
47923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47925         this_ptr_conv.is_owned = false;
47926         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
47927         int64_t ret_ref = 0;
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47930         return ret_ref;
47931 }
47932
47933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47934         LDKUnsignedNodeAnnouncement this_ptr_conv;
47935         this_ptr_conv.inner = untag_ptr(this_ptr);
47936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47938         this_ptr_conv.is_owned = false;
47939         LDKNodeId val_conv;
47940         val_conv.inner = untag_ptr(val);
47941         val_conv.is_owned = ptr_is_owned(val);
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47943         val_conv = NodeId_clone(&val_conv);
47944         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
47945 }
47946
47947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
47948         LDKUnsignedNodeAnnouncement this_ptr_conv;
47949         this_ptr_conv.inner = untag_ptr(this_ptr);
47950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47952         this_ptr_conv.is_owned = false;
47953         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
47954         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
47955         return ret_arr;
47956 }
47957
47958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47959         LDKUnsignedNodeAnnouncement this_ptr_conv;
47960         this_ptr_conv.inner = untag_ptr(this_ptr);
47961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47963         this_ptr_conv.is_owned = false;
47964         LDKThreeBytes val_ref;
47965         CHECK((*env)->GetArrayLength(env, val) == 3);
47966         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
47967         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
47968 }
47969
47970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
47971         LDKUnsignedNodeAnnouncement this_ptr_conv;
47972         this_ptr_conv.inner = untag_ptr(this_ptr);
47973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47975         this_ptr_conv.is_owned = false;
47976         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
47977         int64_t ret_ref = 0;
47978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47980         return ret_ref;
47981 }
47982
47983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47984         LDKUnsignedNodeAnnouncement this_ptr_conv;
47985         this_ptr_conv.inner = untag_ptr(this_ptr);
47986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47988         this_ptr_conv.is_owned = false;
47989         LDKNodeAlias val_conv;
47990         val_conv.inner = untag_ptr(val);
47991         val_conv.is_owned = ptr_is_owned(val);
47992         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47993         val_conv = NodeAlias_clone(&val_conv);
47994         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
47995 }
47996
47997 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
47998         LDKUnsignedNodeAnnouncement this_ptr_conv;
47999         this_ptr_conv.inner = untag_ptr(this_ptr);
48000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48002         this_ptr_conv.is_owned = false;
48003         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
48004         int64_tArray ret_arr = NULL;
48005         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48006         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48007         for (size_t p = 0; p < ret_var.datalen; p++) {
48008                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48009                 *ret_conv_15_copy = ret_var.data[p];
48010                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
48011                 ret_arr_ptr[p] = ret_conv_15_ref;
48012         }
48013         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48014         FREE(ret_var.data);
48015         return ret_arr;
48016 }
48017
48018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
48019         LDKUnsignedNodeAnnouncement this_ptr_conv;
48020         this_ptr_conv.inner = untag_ptr(this_ptr);
48021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48023         this_ptr_conv.is_owned = false;
48024         LDKCVec_SocketAddressZ val_constr;
48025         val_constr.datalen = (*env)->GetArrayLength(env, val);
48026         if (val_constr.datalen > 0)
48027                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
48028         else
48029                 val_constr.data = NULL;
48030         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
48031         for (size_t p = 0; p < val_constr.datalen; p++) {
48032                 int64_t val_conv_15 = val_vals[p];
48033                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
48034                 CHECK_ACCESS(val_conv_15_ptr);
48035                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
48036                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
48037                 val_constr.data[p] = val_conv_15_conv;
48038         }
48039         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
48040         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
48041 }
48042
48043 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
48044         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
48045         int64_t ret_ref = 0;
48046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48048         return ret_ref;
48049 }
48050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48051         LDKUnsignedNodeAnnouncement arg_conv;
48052         arg_conv.inner = untag_ptr(arg);
48053         arg_conv.is_owned = ptr_is_owned(arg);
48054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48055         arg_conv.is_owned = false;
48056         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
48057         return ret_conv;
48058 }
48059
48060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48061         LDKUnsignedNodeAnnouncement orig_conv;
48062         orig_conv.inner = untag_ptr(orig);
48063         orig_conv.is_owned = ptr_is_owned(orig);
48064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48065         orig_conv.is_owned = false;
48066         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48067         int64_t ret_ref = 0;
48068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48070         return ret_ref;
48071 }
48072
48073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48074         LDKUnsignedNodeAnnouncement a_conv;
48075         a_conv.inner = untag_ptr(a);
48076         a_conv.is_owned = ptr_is_owned(a);
48077         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48078         a_conv.is_owned = false;
48079         LDKUnsignedNodeAnnouncement b_conv;
48080         b_conv.inner = untag_ptr(b);
48081         b_conv.is_owned = ptr_is_owned(b);
48082         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48083         b_conv.is_owned = false;
48084         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48085         return ret_conv;
48086 }
48087
48088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48089         LDKNodeAnnouncement this_obj_conv;
48090         this_obj_conv.inner = untag_ptr(this_obj);
48091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48093         NodeAnnouncement_free(this_obj_conv);
48094 }
48095
48096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48097         LDKNodeAnnouncement 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48103         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
48104         return ret_arr;
48105 }
48106
48107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48108         LDKNodeAnnouncement this_ptr_conv;
48109         this_ptr_conv.inner = untag_ptr(this_ptr);
48110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48112         this_ptr_conv.is_owned = false;
48113         LDKECDSASignature val_ref;
48114         CHECK((*env)->GetArrayLength(env, val) == 64);
48115         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48116         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48117 }
48118
48119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
48120         LDKNodeAnnouncement this_ptr_conv;
48121         this_ptr_conv.inner = untag_ptr(this_ptr);
48122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48124         this_ptr_conv.is_owned = false;
48125         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48126         int64_t ret_ref = 0;
48127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48129         return ret_ref;
48130 }
48131
48132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48133         LDKNodeAnnouncement this_ptr_conv;
48134         this_ptr_conv.inner = untag_ptr(this_ptr);
48135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48137         this_ptr_conv.is_owned = false;
48138         LDKUnsignedNodeAnnouncement val_conv;
48139         val_conv.inner = untag_ptr(val);
48140         val_conv.is_owned = ptr_is_owned(val);
48141         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48142         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48143         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48144 }
48145
48146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
48147         LDKECDSASignature signature_arg_ref;
48148         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
48149         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
48150         LDKUnsignedNodeAnnouncement contents_arg_conv;
48151         contents_arg_conv.inner = untag_ptr(contents_arg);
48152         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48153         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48154         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48155         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48156         int64_t ret_ref = 0;
48157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48159         return ret_ref;
48160 }
48161
48162 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48163         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48164         int64_t ret_ref = 0;
48165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48167         return ret_ref;
48168 }
48169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48170         LDKNodeAnnouncement arg_conv;
48171         arg_conv.inner = untag_ptr(arg);
48172         arg_conv.is_owned = ptr_is_owned(arg);
48173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48174         arg_conv.is_owned = false;
48175         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48176         return ret_conv;
48177 }
48178
48179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48180         LDKNodeAnnouncement orig_conv;
48181         orig_conv.inner = untag_ptr(orig);
48182         orig_conv.is_owned = ptr_is_owned(orig);
48183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48184         orig_conv.is_owned = false;
48185         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48186         int64_t ret_ref = 0;
48187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48189         return ret_ref;
48190 }
48191
48192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48193         LDKNodeAnnouncement a_conv;
48194         a_conv.inner = untag_ptr(a);
48195         a_conv.is_owned = ptr_is_owned(a);
48196         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48197         a_conv.is_owned = false;
48198         LDKNodeAnnouncement b_conv;
48199         b_conv.inner = untag_ptr(b);
48200         b_conv.is_owned = ptr_is_owned(b);
48201         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48202         b_conv.is_owned = false;
48203         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48204         return ret_conv;
48205 }
48206
48207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48208         LDKUnsignedChannelAnnouncement this_obj_conv;
48209         this_obj_conv.inner = untag_ptr(this_obj);
48210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48212         UnsignedChannelAnnouncement_free(this_obj_conv);
48213 }
48214
48215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48216         LDKUnsignedChannelAnnouncement this_ptr_conv;
48217         this_ptr_conv.inner = untag_ptr(this_ptr);
48218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48220         this_ptr_conv.is_owned = false;
48221         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48222         int64_t ret_ref = 0;
48223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48225         return ret_ref;
48226 }
48227
48228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48229         LDKUnsignedChannelAnnouncement this_ptr_conv;
48230         this_ptr_conv.inner = untag_ptr(this_ptr);
48231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48233         this_ptr_conv.is_owned = false;
48234         LDKChannelFeatures val_conv;
48235         val_conv.inner = untag_ptr(val);
48236         val_conv.is_owned = ptr_is_owned(val);
48237         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48238         val_conv = ChannelFeatures_clone(&val_conv);
48239         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48240 }
48241
48242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
48243         LDKUnsignedChannelAnnouncement this_ptr_conv;
48244         this_ptr_conv.inner = untag_ptr(this_ptr);
48245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48247         this_ptr_conv.is_owned = false;
48248         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48249         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
48250         return ret_arr;
48251 }
48252
48253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48254         LDKUnsignedChannelAnnouncement this_ptr_conv;
48255         this_ptr_conv.inner = untag_ptr(this_ptr);
48256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48258         this_ptr_conv.is_owned = false;
48259         LDKThirtyTwoBytes val_ref;
48260         CHECK((*env)->GetArrayLength(env, val) == 32);
48261         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48262         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48263 }
48264
48265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48266         LDKUnsignedChannelAnnouncement this_ptr_conv;
48267         this_ptr_conv.inner = untag_ptr(this_ptr);
48268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48270         this_ptr_conv.is_owned = false;
48271         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48272         return ret_conv;
48273 }
48274
48275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48276         LDKUnsignedChannelAnnouncement this_ptr_conv;
48277         this_ptr_conv.inner = untag_ptr(this_ptr);
48278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48280         this_ptr_conv.is_owned = false;
48281         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48282 }
48283
48284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48285         LDKUnsignedChannelAnnouncement 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         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48291         int64_t ret_ref = 0;
48292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48294         return ret_ref;
48295 }
48296
48297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48298         LDKUnsignedChannelAnnouncement 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         LDKNodeId val_conv;
48304         val_conv.inner = untag_ptr(val);
48305         val_conv.is_owned = ptr_is_owned(val);
48306         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48307         val_conv = NodeId_clone(&val_conv);
48308         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48309 }
48310
48311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48312         LDKUnsignedChannelAnnouncement this_ptr_conv;
48313         this_ptr_conv.inner = untag_ptr(this_ptr);
48314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48316         this_ptr_conv.is_owned = false;
48317         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48318         int64_t ret_ref = 0;
48319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48321         return ret_ref;
48322 }
48323
48324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48325         LDKUnsignedChannelAnnouncement this_ptr_conv;
48326         this_ptr_conv.inner = untag_ptr(this_ptr);
48327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48329         this_ptr_conv.is_owned = false;
48330         LDKNodeId val_conv;
48331         val_conv.inner = untag_ptr(val);
48332         val_conv.is_owned = ptr_is_owned(val);
48333         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48334         val_conv = NodeId_clone(&val_conv);
48335         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48336 }
48337
48338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48339         LDKUnsignedChannelAnnouncement this_ptr_conv;
48340         this_ptr_conv.inner = untag_ptr(this_ptr);
48341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48343         this_ptr_conv.is_owned = false;
48344         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48345         int64_t ret_ref = 0;
48346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48348         return ret_ref;
48349 }
48350
48351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48352         LDKUnsignedChannelAnnouncement this_ptr_conv;
48353         this_ptr_conv.inner = untag_ptr(this_ptr);
48354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48356         this_ptr_conv.is_owned = false;
48357         LDKNodeId val_conv;
48358         val_conv.inner = untag_ptr(val);
48359         val_conv.is_owned = ptr_is_owned(val);
48360         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48361         val_conv = NodeId_clone(&val_conv);
48362         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
48363 }
48364
48365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48366         LDKUnsignedChannelAnnouncement this_ptr_conv;
48367         this_ptr_conv.inner = untag_ptr(this_ptr);
48368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48370         this_ptr_conv.is_owned = false;
48371         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
48372         int64_t ret_ref = 0;
48373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48375         return ret_ref;
48376 }
48377
48378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48379         LDKUnsignedChannelAnnouncement this_ptr_conv;
48380         this_ptr_conv.inner = untag_ptr(this_ptr);
48381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48383         this_ptr_conv.is_owned = false;
48384         LDKNodeId val_conv;
48385         val_conv.inner = untag_ptr(val);
48386         val_conv.is_owned = ptr_is_owned(val);
48387         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48388         val_conv = NodeId_clone(&val_conv);
48389         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
48390 }
48391
48392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
48393         LDKUnsignedChannelAnnouncement this_ptr_conv;
48394         this_ptr_conv.inner = untag_ptr(this_ptr);
48395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48397         this_ptr_conv.is_owned = false;
48398         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
48399         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48400         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48401         CVec_u8Z_free(ret_var);
48402         return ret_arr;
48403 }
48404
48405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48406         LDKUnsignedChannelAnnouncement this_ptr_conv;
48407         this_ptr_conv.inner = untag_ptr(this_ptr);
48408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48410         this_ptr_conv.is_owned = false;
48411         LDKCVec_u8Z val_ref;
48412         val_ref.datalen = (*env)->GetArrayLength(env, val);
48413         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48414         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
48415         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
48416 }
48417
48418 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) {
48419         LDKChannelFeatures features_arg_conv;
48420         features_arg_conv.inner = untag_ptr(features_arg);
48421         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48422         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48423         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
48424         LDKThirtyTwoBytes chain_hash_arg_ref;
48425         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
48426         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
48427         LDKNodeId node_id_1_arg_conv;
48428         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
48429         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
48430         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
48431         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
48432         LDKNodeId node_id_2_arg_conv;
48433         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
48434         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
48435         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
48436         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
48437         LDKNodeId bitcoin_key_1_arg_conv;
48438         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
48439         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
48440         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
48441         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
48442         LDKNodeId bitcoin_key_2_arg_conv;
48443         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
48444         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
48445         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
48446         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
48447         LDKCVec_u8Z excess_data_arg_ref;
48448         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
48449         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48450         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
48451         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);
48452         int64_t ret_ref = 0;
48453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48455         return ret_ref;
48456 }
48457
48458 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
48459         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
48460         int64_t ret_ref = 0;
48461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48463         return ret_ref;
48464 }
48465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48466         LDKUnsignedChannelAnnouncement arg_conv;
48467         arg_conv.inner = untag_ptr(arg);
48468         arg_conv.is_owned = ptr_is_owned(arg);
48469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48470         arg_conv.is_owned = false;
48471         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
48472         return ret_conv;
48473 }
48474
48475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48476         LDKUnsignedChannelAnnouncement orig_conv;
48477         orig_conv.inner = untag_ptr(orig);
48478         orig_conv.is_owned = ptr_is_owned(orig);
48479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48480         orig_conv.is_owned = false;
48481         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
48482         int64_t ret_ref = 0;
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48485         return ret_ref;
48486 }
48487
48488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48489         LDKUnsignedChannelAnnouncement a_conv;
48490         a_conv.inner = untag_ptr(a);
48491         a_conv.is_owned = ptr_is_owned(a);
48492         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48493         a_conv.is_owned = false;
48494         LDKUnsignedChannelAnnouncement b_conv;
48495         b_conv.inner = untag_ptr(b);
48496         b_conv.is_owned = ptr_is_owned(b);
48497         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48498         b_conv.is_owned = false;
48499         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
48500         return ret_conv;
48501 }
48502
48503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48504         LDKChannelAnnouncement this_obj_conv;
48505         this_obj_conv.inner = untag_ptr(this_obj);
48506         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48508         ChannelAnnouncement_free(this_obj_conv);
48509 }
48510
48511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48512         LDKChannelAnnouncement this_ptr_conv;
48513         this_ptr_conv.inner = untag_ptr(this_ptr);
48514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48516         this_ptr_conv.is_owned = false;
48517         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48518         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
48519         return ret_arr;
48520 }
48521
48522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48523         LDKChannelAnnouncement this_ptr_conv;
48524         this_ptr_conv.inner = untag_ptr(this_ptr);
48525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48527         this_ptr_conv.is_owned = false;
48528         LDKECDSASignature val_ref;
48529         CHECK((*env)->GetArrayLength(env, val) == 64);
48530         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48531         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
48532 }
48533
48534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48535         LDKChannelAnnouncement 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48541         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
48542         return ret_arr;
48543 }
48544
48545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48546         LDKChannelAnnouncement this_ptr_conv;
48547         this_ptr_conv.inner = untag_ptr(this_ptr);
48548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48550         this_ptr_conv.is_owned = false;
48551         LDKECDSASignature val_ref;
48552         CHECK((*env)->GetArrayLength(env, val) == 64);
48553         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48554         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
48555 }
48556
48557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48558         LDKChannelAnnouncement this_ptr_conv;
48559         this_ptr_conv.inner = untag_ptr(this_ptr);
48560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48562         this_ptr_conv.is_owned = false;
48563         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48564         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
48565         return ret_arr;
48566 }
48567
48568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48569         LDKChannelAnnouncement this_ptr_conv;
48570         this_ptr_conv.inner = untag_ptr(this_ptr);
48571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48573         this_ptr_conv.is_owned = false;
48574         LDKECDSASignature val_ref;
48575         CHECK((*env)->GetArrayLength(env, val) == 64);
48576         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48577         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
48578 }
48579
48580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48581         LDKChannelAnnouncement this_ptr_conv;
48582         this_ptr_conv.inner = untag_ptr(this_ptr);
48583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48585         this_ptr_conv.is_owned = false;
48586         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48587         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
48588         return ret_arr;
48589 }
48590
48591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48592         LDKChannelAnnouncement this_ptr_conv;
48593         this_ptr_conv.inner = untag_ptr(this_ptr);
48594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48596         this_ptr_conv.is_owned = false;
48597         LDKECDSASignature val_ref;
48598         CHECK((*env)->GetArrayLength(env, val) == 64);
48599         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48600         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
48601 }
48602
48603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
48604         LDKChannelAnnouncement this_ptr_conv;
48605         this_ptr_conv.inner = untag_ptr(this_ptr);
48606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48608         this_ptr_conv.is_owned = false;
48609         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
48610         int64_t ret_ref = 0;
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48613         return ret_ref;
48614 }
48615
48616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48617         LDKChannelAnnouncement this_ptr_conv;
48618         this_ptr_conv.inner = untag_ptr(this_ptr);
48619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48621         this_ptr_conv.is_owned = false;
48622         LDKUnsignedChannelAnnouncement val_conv;
48623         val_conv.inner = untag_ptr(val);
48624         val_conv.is_owned = ptr_is_owned(val);
48625         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48626         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
48627         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
48628 }
48629
48630 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) {
48631         LDKECDSASignature node_signature_1_arg_ref;
48632         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
48633         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
48634         LDKECDSASignature node_signature_2_arg_ref;
48635         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
48636         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
48637         LDKECDSASignature bitcoin_signature_1_arg_ref;
48638         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
48639         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
48640         LDKECDSASignature bitcoin_signature_2_arg_ref;
48641         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
48642         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
48643         LDKUnsignedChannelAnnouncement contents_arg_conv;
48644         contents_arg_conv.inner = untag_ptr(contents_arg);
48645         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48646         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48647         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
48648         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);
48649         int64_t ret_ref = 0;
48650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48652         return ret_ref;
48653 }
48654
48655 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
48656         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
48657         int64_t ret_ref = 0;
48658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48660         return ret_ref;
48661 }
48662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48663         LDKChannelAnnouncement arg_conv;
48664         arg_conv.inner = untag_ptr(arg);
48665         arg_conv.is_owned = ptr_is_owned(arg);
48666         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48667         arg_conv.is_owned = false;
48668         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
48669         return ret_conv;
48670 }
48671
48672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48673         LDKChannelAnnouncement orig_conv;
48674         orig_conv.inner = untag_ptr(orig);
48675         orig_conv.is_owned = ptr_is_owned(orig);
48676         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48677         orig_conv.is_owned = false;
48678         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
48679         int64_t ret_ref = 0;
48680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48682         return ret_ref;
48683 }
48684
48685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48686         LDKChannelAnnouncement a_conv;
48687         a_conv.inner = untag_ptr(a);
48688         a_conv.is_owned = ptr_is_owned(a);
48689         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48690         a_conv.is_owned = false;
48691         LDKChannelAnnouncement b_conv;
48692         b_conv.inner = untag_ptr(b);
48693         b_conv.is_owned = ptr_is_owned(b);
48694         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48695         b_conv.is_owned = false;
48696         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
48697         return ret_conv;
48698 }
48699
48700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48701         LDKUnsignedChannelUpdate this_obj_conv;
48702         this_obj_conv.inner = untag_ptr(this_obj);
48703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48705         UnsignedChannelUpdate_free(this_obj_conv);
48706 }
48707
48708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
48709         LDKUnsignedChannelUpdate this_ptr_conv;
48710         this_ptr_conv.inner = untag_ptr(this_ptr);
48711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48713         this_ptr_conv.is_owned = false;
48714         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48715         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
48716         return ret_arr;
48717 }
48718
48719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48720         LDKUnsignedChannelUpdate 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         LDKThirtyTwoBytes val_ref;
48726         CHECK((*env)->GetArrayLength(env, val) == 32);
48727         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48728         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
48729 }
48730
48731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48732         LDKUnsignedChannelUpdate this_ptr_conv;
48733         this_ptr_conv.inner = untag_ptr(this_ptr);
48734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48736         this_ptr_conv.is_owned = false;
48737         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
48738         return ret_conv;
48739 }
48740
48741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48742         LDKUnsignedChannelUpdate this_ptr_conv;
48743         this_ptr_conv.inner = untag_ptr(this_ptr);
48744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48746         this_ptr_conv.is_owned = false;
48747         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
48748 }
48749
48750 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
48751         LDKUnsignedChannelUpdate this_ptr_conv;
48752         this_ptr_conv.inner = untag_ptr(this_ptr);
48753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48755         this_ptr_conv.is_owned = false;
48756         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
48757         return ret_conv;
48758 }
48759
48760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48761         LDKUnsignedChannelUpdate this_ptr_conv;
48762         this_ptr_conv.inner = untag_ptr(this_ptr);
48763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48765         this_ptr_conv.is_owned = false;
48766         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
48767 }
48768
48769 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
48770         LDKUnsignedChannelUpdate this_ptr_conv;
48771         this_ptr_conv.inner = untag_ptr(this_ptr);
48772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48774         this_ptr_conv.is_owned = false;
48775         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
48776         return ret_conv;
48777 }
48778
48779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
48780         LDKUnsignedChannelUpdate this_ptr_conv;
48781         this_ptr_conv.inner = untag_ptr(this_ptr);
48782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48784         this_ptr_conv.is_owned = false;
48785         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
48786 }
48787
48788 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
48789         LDKUnsignedChannelUpdate this_ptr_conv;
48790         this_ptr_conv.inner = untag_ptr(this_ptr);
48791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48793         this_ptr_conv.is_owned = false;
48794         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
48795         return ret_conv;
48796 }
48797
48798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48799         LDKUnsignedChannelUpdate this_ptr_conv;
48800         this_ptr_conv.inner = untag_ptr(this_ptr);
48801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48803         this_ptr_conv.is_owned = false;
48804         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
48805 }
48806
48807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48808         LDKUnsignedChannelUpdate this_ptr_conv;
48809         this_ptr_conv.inner = untag_ptr(this_ptr);
48810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48812         this_ptr_conv.is_owned = false;
48813         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
48814         return ret_conv;
48815 }
48816
48817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48818         LDKUnsignedChannelUpdate this_ptr_conv;
48819         this_ptr_conv.inner = untag_ptr(this_ptr);
48820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48822         this_ptr_conv.is_owned = false;
48823         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
48824 }
48825
48826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48827         LDKUnsignedChannelUpdate this_ptr_conv;
48828         this_ptr_conv.inner = untag_ptr(this_ptr);
48829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48831         this_ptr_conv.is_owned = false;
48832         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
48833         return ret_conv;
48834 }
48835
48836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48837         LDKUnsignedChannelUpdate this_ptr_conv;
48838         this_ptr_conv.inner = untag_ptr(this_ptr);
48839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48841         this_ptr_conv.is_owned = false;
48842         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
48843 }
48844
48845 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48846         LDKUnsignedChannelUpdate this_ptr_conv;
48847         this_ptr_conv.inner = untag_ptr(this_ptr);
48848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48850         this_ptr_conv.is_owned = false;
48851         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
48852         return ret_conv;
48853 }
48854
48855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48856         LDKUnsignedChannelUpdate this_ptr_conv;
48857         this_ptr_conv.inner = untag_ptr(this_ptr);
48858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48860         this_ptr_conv.is_owned = false;
48861         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
48862 }
48863
48864 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
48865         LDKUnsignedChannelUpdate this_ptr_conv;
48866         this_ptr_conv.inner = untag_ptr(this_ptr);
48867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48869         this_ptr_conv.is_owned = false;
48870         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
48871         return ret_conv;
48872 }
48873
48874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48875         LDKUnsignedChannelUpdate this_ptr_conv;
48876         this_ptr_conv.inner = untag_ptr(this_ptr);
48877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48879         this_ptr_conv.is_owned = false;
48880         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
48881 }
48882
48883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
48884         LDKUnsignedChannelUpdate this_ptr_conv;
48885         this_ptr_conv.inner = untag_ptr(this_ptr);
48886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48888         this_ptr_conv.is_owned = false;
48889         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
48890         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48891         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48892         CVec_u8Z_free(ret_var);
48893         return ret_arr;
48894 }
48895
48896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48897         LDKUnsignedChannelUpdate this_ptr_conv;
48898         this_ptr_conv.inner = untag_ptr(this_ptr);
48899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48901         this_ptr_conv.is_owned = false;
48902         LDKCVec_u8Z val_ref;
48903         val_ref.datalen = (*env)->GetArrayLength(env, val);
48904         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48905         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
48906         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
48907 }
48908
48909 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) {
48910         LDKThirtyTwoBytes chain_hash_arg_ref;
48911         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
48912         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
48913         LDKCVec_u8Z excess_data_arg_ref;
48914         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
48915         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48916         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
48917         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);
48918         int64_t ret_ref = 0;
48919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48921         return ret_ref;
48922 }
48923
48924 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
48925         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
48926         int64_t ret_ref = 0;
48927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48929         return ret_ref;
48930 }
48931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48932         LDKUnsignedChannelUpdate arg_conv;
48933         arg_conv.inner = untag_ptr(arg);
48934         arg_conv.is_owned = ptr_is_owned(arg);
48935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48936         arg_conv.is_owned = false;
48937         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
48938         return ret_conv;
48939 }
48940
48941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48942         LDKUnsignedChannelUpdate orig_conv;
48943         orig_conv.inner = untag_ptr(orig);
48944         orig_conv.is_owned = ptr_is_owned(orig);
48945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48946         orig_conv.is_owned = false;
48947         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
48948         int64_t ret_ref = 0;
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48951         return ret_ref;
48952 }
48953
48954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48955         LDKUnsignedChannelUpdate a_conv;
48956         a_conv.inner = untag_ptr(a);
48957         a_conv.is_owned = ptr_is_owned(a);
48958         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48959         a_conv.is_owned = false;
48960         LDKUnsignedChannelUpdate b_conv;
48961         b_conv.inner = untag_ptr(b);
48962         b_conv.is_owned = ptr_is_owned(b);
48963         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48964         b_conv.is_owned = false;
48965         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
48966         return ret_conv;
48967 }
48968
48969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48970         LDKChannelUpdate this_obj_conv;
48971         this_obj_conv.inner = untag_ptr(this_obj);
48972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48974         ChannelUpdate_free(this_obj_conv);
48975 }
48976
48977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48978         LDKChannelUpdate this_ptr_conv;
48979         this_ptr_conv.inner = untag_ptr(this_ptr);
48980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48982         this_ptr_conv.is_owned = false;
48983         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48984         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
48985         return ret_arr;
48986 }
48987
48988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48989         LDKChannelUpdate this_ptr_conv;
48990         this_ptr_conv.inner = untag_ptr(this_ptr);
48991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48993         this_ptr_conv.is_owned = false;
48994         LDKECDSASignature val_ref;
48995         CHECK((*env)->GetArrayLength(env, val) == 64);
48996         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48997         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
48998 }
48999
49000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
49001         LDKChannelUpdate this_ptr_conv;
49002         this_ptr_conv.inner = untag_ptr(this_ptr);
49003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49005         this_ptr_conv.is_owned = false;
49006         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
49007         int64_t ret_ref = 0;
49008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49010         return ret_ref;
49011 }
49012
49013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49014         LDKChannelUpdate this_ptr_conv;
49015         this_ptr_conv.inner = untag_ptr(this_ptr);
49016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49018         this_ptr_conv.is_owned = false;
49019         LDKUnsignedChannelUpdate val_conv;
49020         val_conv.inner = untag_ptr(val);
49021         val_conv.is_owned = ptr_is_owned(val);
49022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49023         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49024         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49025 }
49026
49027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
49028         LDKECDSASignature signature_arg_ref;
49029         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49030         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49031         LDKUnsignedChannelUpdate contents_arg_conv;
49032         contents_arg_conv.inner = untag_ptr(contents_arg);
49033         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49034         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49035         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49036         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49037         int64_t ret_ref = 0;
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49040         return ret_ref;
49041 }
49042
49043 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49044         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49045         int64_t ret_ref = 0;
49046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49048         return ret_ref;
49049 }
49050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49051         LDKChannelUpdate arg_conv;
49052         arg_conv.inner = untag_ptr(arg);
49053         arg_conv.is_owned = ptr_is_owned(arg);
49054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49055         arg_conv.is_owned = false;
49056         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49057         return ret_conv;
49058 }
49059
49060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49061         LDKChannelUpdate orig_conv;
49062         orig_conv.inner = untag_ptr(orig);
49063         orig_conv.is_owned = ptr_is_owned(orig);
49064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49065         orig_conv.is_owned = false;
49066         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49067         int64_t ret_ref = 0;
49068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49070         return ret_ref;
49071 }
49072
49073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49074         LDKChannelUpdate a_conv;
49075         a_conv.inner = untag_ptr(a);
49076         a_conv.is_owned = ptr_is_owned(a);
49077         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49078         a_conv.is_owned = false;
49079         LDKChannelUpdate b_conv;
49080         b_conv.inner = untag_ptr(b);
49081         b_conv.is_owned = ptr_is_owned(b);
49082         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49083         b_conv.is_owned = false;
49084         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49085         return ret_conv;
49086 }
49087
49088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49089         LDKQueryChannelRange this_obj_conv;
49090         this_obj_conv.inner = untag_ptr(this_obj);
49091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49093         QueryChannelRange_free(this_obj_conv);
49094 }
49095
49096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49097         LDKQueryChannelRange this_ptr_conv;
49098         this_ptr_conv.inner = untag_ptr(this_ptr);
49099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49101         this_ptr_conv.is_owned = false;
49102         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49103         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
49104         return ret_arr;
49105 }
49106
49107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49108         LDKQueryChannelRange this_ptr_conv;
49109         this_ptr_conv.inner = untag_ptr(this_ptr);
49110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49112         this_ptr_conv.is_owned = false;
49113         LDKThirtyTwoBytes val_ref;
49114         CHECK((*env)->GetArrayLength(env, val) == 32);
49115         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49116         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49117 }
49118
49119 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49120         LDKQueryChannelRange this_ptr_conv;
49121         this_ptr_conv.inner = untag_ptr(this_ptr);
49122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49124         this_ptr_conv.is_owned = false;
49125         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49126         return ret_conv;
49127 }
49128
49129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49130         LDKQueryChannelRange this_ptr_conv;
49131         this_ptr_conv.inner = untag_ptr(this_ptr);
49132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49134         this_ptr_conv.is_owned = false;
49135         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49136 }
49137
49138 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49139         LDKQueryChannelRange this_ptr_conv;
49140         this_ptr_conv.inner = untag_ptr(this_ptr);
49141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49143         this_ptr_conv.is_owned = false;
49144         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49145         return ret_conv;
49146 }
49147
49148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49149         LDKQueryChannelRange this_ptr_conv;
49150         this_ptr_conv.inner = untag_ptr(this_ptr);
49151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49153         this_ptr_conv.is_owned = false;
49154         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49155 }
49156
49157 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) {
49158         LDKThirtyTwoBytes chain_hash_arg_ref;
49159         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49160         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49161         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49162         int64_t ret_ref = 0;
49163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49165         return ret_ref;
49166 }
49167
49168 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49169         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49170         int64_t ret_ref = 0;
49171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49173         return ret_ref;
49174 }
49175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49176         LDKQueryChannelRange arg_conv;
49177         arg_conv.inner = untag_ptr(arg);
49178         arg_conv.is_owned = ptr_is_owned(arg);
49179         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49180         arg_conv.is_owned = false;
49181         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49182         return ret_conv;
49183 }
49184
49185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49186         LDKQueryChannelRange orig_conv;
49187         orig_conv.inner = untag_ptr(orig);
49188         orig_conv.is_owned = ptr_is_owned(orig);
49189         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49190         orig_conv.is_owned = false;
49191         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49192         int64_t ret_ref = 0;
49193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49195         return ret_ref;
49196 }
49197
49198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49199         LDKQueryChannelRange a_conv;
49200         a_conv.inner = untag_ptr(a);
49201         a_conv.is_owned = ptr_is_owned(a);
49202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49203         a_conv.is_owned = false;
49204         LDKQueryChannelRange b_conv;
49205         b_conv.inner = untag_ptr(b);
49206         b_conv.is_owned = ptr_is_owned(b);
49207         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49208         b_conv.is_owned = false;
49209         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49210         return ret_conv;
49211 }
49212
49213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49214         LDKReplyChannelRange this_obj_conv;
49215         this_obj_conv.inner = untag_ptr(this_obj);
49216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49218         ReplyChannelRange_free(this_obj_conv);
49219 }
49220
49221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49222         LDKReplyChannelRange 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49228         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
49229         return ret_arr;
49230 }
49231
49232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49233         LDKReplyChannelRange this_ptr_conv;
49234         this_ptr_conv.inner = untag_ptr(this_ptr);
49235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49237         this_ptr_conv.is_owned = false;
49238         LDKThirtyTwoBytes val_ref;
49239         CHECK((*env)->GetArrayLength(env, val) == 32);
49240         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49241         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49242 }
49243
49244 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49245         LDKReplyChannelRange 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         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49251         return ret_conv;
49252 }
49253
49254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49255         LDKReplyChannelRange this_ptr_conv;
49256         this_ptr_conv.inner = untag_ptr(this_ptr);
49257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49259         this_ptr_conv.is_owned = false;
49260         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49261 }
49262
49263 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49264         LDKReplyChannelRange this_ptr_conv;
49265         this_ptr_conv.inner = untag_ptr(this_ptr);
49266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49268         this_ptr_conv.is_owned = false;
49269         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49270         return ret_conv;
49271 }
49272
49273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49274         LDKReplyChannelRange this_ptr_conv;
49275         this_ptr_conv.inner = untag_ptr(this_ptr);
49276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49278         this_ptr_conv.is_owned = false;
49279         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49280 }
49281
49282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
49283         LDKReplyChannelRange this_ptr_conv;
49284         this_ptr_conv.inner = untag_ptr(this_ptr);
49285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49287         this_ptr_conv.is_owned = false;
49288         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49289         return ret_conv;
49290 }
49291
49292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
49293         LDKReplyChannelRange this_ptr_conv;
49294         this_ptr_conv.inner = untag_ptr(this_ptr);
49295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49297         this_ptr_conv.is_owned = false;
49298         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49299 }
49300
49301 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
49302         LDKReplyChannelRange this_ptr_conv;
49303         this_ptr_conv.inner = untag_ptr(this_ptr);
49304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49306         this_ptr_conv.is_owned = false;
49307         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49308         int64_tArray ret_arr = NULL;
49309         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49310         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49311         for (size_t g = 0; g < ret_var.datalen; g++) {
49312                 int64_t ret_conv_6_conv = ret_var.data[g];
49313                 ret_arr_ptr[g] = ret_conv_6_conv;
49314         }
49315         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49316         FREE(ret_var.data);
49317         return ret_arr;
49318 }
49319
49320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
49321         LDKReplyChannelRange this_ptr_conv;
49322         this_ptr_conv.inner = untag_ptr(this_ptr);
49323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49325         this_ptr_conv.is_owned = false;
49326         LDKCVec_u64Z val_constr;
49327         val_constr.datalen = (*env)->GetArrayLength(env, val);
49328         if (val_constr.datalen > 0)
49329                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49330         else
49331                 val_constr.data = NULL;
49332         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
49333         for (size_t g = 0; g < val_constr.datalen; g++) {
49334                 int64_t val_conv_6 = val_vals[g];
49335                 val_constr.data[g] = val_conv_6;
49336         }
49337         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
49338         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49339 }
49340
49341 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) {
49342         LDKThirtyTwoBytes chain_hash_arg_ref;
49343         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49344         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49345         LDKCVec_u64Z short_channel_ids_arg_constr;
49346         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
49347         if (short_channel_ids_arg_constr.datalen > 0)
49348                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49349         else
49350                 short_channel_ids_arg_constr.data = NULL;
49351         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
49352         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49353                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49354                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49355         }
49356         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
49357         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
49358         int64_t ret_ref = 0;
49359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49361         return ret_ref;
49362 }
49363
49364 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
49365         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
49366         int64_t ret_ref = 0;
49367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49369         return ret_ref;
49370 }
49371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49372         LDKReplyChannelRange arg_conv;
49373         arg_conv.inner = untag_ptr(arg);
49374         arg_conv.is_owned = ptr_is_owned(arg);
49375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49376         arg_conv.is_owned = false;
49377         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
49378         return ret_conv;
49379 }
49380
49381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49382         LDKReplyChannelRange orig_conv;
49383         orig_conv.inner = untag_ptr(orig);
49384         orig_conv.is_owned = ptr_is_owned(orig);
49385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49386         orig_conv.is_owned = false;
49387         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
49388         int64_t ret_ref = 0;
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49391         return ret_ref;
49392 }
49393
49394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49395         LDKReplyChannelRange a_conv;
49396         a_conv.inner = untag_ptr(a);
49397         a_conv.is_owned = ptr_is_owned(a);
49398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49399         a_conv.is_owned = false;
49400         LDKReplyChannelRange b_conv;
49401         b_conv.inner = untag_ptr(b);
49402         b_conv.is_owned = ptr_is_owned(b);
49403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49404         b_conv.is_owned = false;
49405         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
49406         return ret_conv;
49407 }
49408
49409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49410         LDKQueryShortChannelIds this_obj_conv;
49411         this_obj_conv.inner = untag_ptr(this_obj);
49412         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49414         QueryShortChannelIds_free(this_obj_conv);
49415 }
49416
49417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49418         LDKQueryShortChannelIds this_ptr_conv;
49419         this_ptr_conv.inner = untag_ptr(this_ptr);
49420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49422         this_ptr_conv.is_owned = false;
49423         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49424         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
49425         return ret_arr;
49426 }
49427
49428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49429         LDKQueryShortChannelIds this_ptr_conv;
49430         this_ptr_conv.inner = untag_ptr(this_ptr);
49431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49433         this_ptr_conv.is_owned = false;
49434         LDKThirtyTwoBytes val_ref;
49435         CHECK((*env)->GetArrayLength(env, val) == 32);
49436         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49437         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
49438 }
49439
49440 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
49441         LDKQueryShortChannelIds this_ptr_conv;
49442         this_ptr_conv.inner = untag_ptr(this_ptr);
49443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49445         this_ptr_conv.is_owned = false;
49446         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
49447         int64_tArray ret_arr = NULL;
49448         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49449         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49450         for (size_t g = 0; g < ret_var.datalen; g++) {
49451                 int64_t ret_conv_6_conv = ret_var.data[g];
49452                 ret_arr_ptr[g] = ret_conv_6_conv;
49453         }
49454         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49455         FREE(ret_var.data);
49456         return ret_arr;
49457 }
49458
49459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
49460         LDKQueryShortChannelIds this_ptr_conv;
49461         this_ptr_conv.inner = untag_ptr(this_ptr);
49462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49464         this_ptr_conv.is_owned = false;
49465         LDKCVec_u64Z val_constr;
49466         val_constr.datalen = (*env)->GetArrayLength(env, val);
49467         if (val_constr.datalen > 0)
49468                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49469         else
49470                 val_constr.data = NULL;
49471         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
49472         for (size_t g = 0; g < val_constr.datalen; g++) {
49473                 int64_t val_conv_6 = val_vals[g];
49474                 val_constr.data[g] = val_conv_6;
49475         }
49476         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
49477         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
49478 }
49479
49480 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) {
49481         LDKThirtyTwoBytes chain_hash_arg_ref;
49482         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49483         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49484         LDKCVec_u64Z short_channel_ids_arg_constr;
49485         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
49486         if (short_channel_ids_arg_constr.datalen > 0)
49487                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49488         else
49489                 short_channel_ids_arg_constr.data = NULL;
49490         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
49491         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49492                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49493                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49494         }
49495         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
49496         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
49497         int64_t ret_ref = 0;
49498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49500         return ret_ref;
49501 }
49502
49503 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
49504         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
49505         int64_t ret_ref = 0;
49506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49508         return ret_ref;
49509 }
49510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49511         LDKQueryShortChannelIds arg_conv;
49512         arg_conv.inner = untag_ptr(arg);
49513         arg_conv.is_owned = ptr_is_owned(arg);
49514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49515         arg_conv.is_owned = false;
49516         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
49517         return ret_conv;
49518 }
49519
49520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49521         LDKQueryShortChannelIds orig_conv;
49522         orig_conv.inner = untag_ptr(orig);
49523         orig_conv.is_owned = ptr_is_owned(orig);
49524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49525         orig_conv.is_owned = false;
49526         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
49527         int64_t ret_ref = 0;
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49530         return ret_ref;
49531 }
49532
49533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49534         LDKQueryShortChannelIds a_conv;
49535         a_conv.inner = untag_ptr(a);
49536         a_conv.is_owned = ptr_is_owned(a);
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49538         a_conv.is_owned = false;
49539         LDKQueryShortChannelIds b_conv;
49540         b_conv.inner = untag_ptr(b);
49541         b_conv.is_owned = ptr_is_owned(b);
49542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49543         b_conv.is_owned = false;
49544         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
49545         return ret_conv;
49546 }
49547
49548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49549         LDKReplyShortChannelIdsEnd this_obj_conv;
49550         this_obj_conv.inner = untag_ptr(this_obj);
49551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49553         ReplyShortChannelIdsEnd_free(this_obj_conv);
49554 }
49555
49556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49557         LDKReplyShortChannelIdsEnd this_ptr_conv;
49558         this_ptr_conv.inner = untag_ptr(this_ptr);
49559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49561         this_ptr_conv.is_owned = false;
49562         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49563         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
49564         return ret_arr;
49565 }
49566
49567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49568         LDKReplyShortChannelIdsEnd this_ptr_conv;
49569         this_ptr_conv.inner = untag_ptr(this_ptr);
49570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49572         this_ptr_conv.is_owned = false;
49573         LDKThirtyTwoBytes val_ref;
49574         CHECK((*env)->GetArrayLength(env, val) == 32);
49575         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49576         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
49577 }
49578
49579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
49580         LDKReplyShortChannelIdsEnd this_ptr_conv;
49581         this_ptr_conv.inner = untag_ptr(this_ptr);
49582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49584         this_ptr_conv.is_owned = false;
49585         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
49586         return ret_conv;
49587 }
49588
49589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
49590         LDKReplyShortChannelIdsEnd this_ptr_conv;
49591         this_ptr_conv.inner = untag_ptr(this_ptr);
49592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49594         this_ptr_conv.is_owned = false;
49595         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
49596 }
49597
49598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
49599         LDKThirtyTwoBytes chain_hash_arg_ref;
49600         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49601         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49602         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
49603         int64_t ret_ref = 0;
49604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49606         return ret_ref;
49607 }
49608
49609 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
49610         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
49611         int64_t ret_ref = 0;
49612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49614         return ret_ref;
49615 }
49616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49617         LDKReplyShortChannelIdsEnd arg_conv;
49618         arg_conv.inner = untag_ptr(arg);
49619         arg_conv.is_owned = ptr_is_owned(arg);
49620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49621         arg_conv.is_owned = false;
49622         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
49623         return ret_conv;
49624 }
49625
49626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49627         LDKReplyShortChannelIdsEnd orig_conv;
49628         orig_conv.inner = untag_ptr(orig);
49629         orig_conv.is_owned = ptr_is_owned(orig);
49630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49631         orig_conv.is_owned = false;
49632         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
49633         int64_t ret_ref = 0;
49634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49636         return ret_ref;
49637 }
49638
49639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49640         LDKReplyShortChannelIdsEnd a_conv;
49641         a_conv.inner = untag_ptr(a);
49642         a_conv.is_owned = ptr_is_owned(a);
49643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49644         a_conv.is_owned = false;
49645         LDKReplyShortChannelIdsEnd b_conv;
49646         b_conv.inner = untag_ptr(b);
49647         b_conv.is_owned = ptr_is_owned(b);
49648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49649         b_conv.is_owned = false;
49650         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
49651         return ret_conv;
49652 }
49653
49654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49655         LDKGossipTimestampFilter this_obj_conv;
49656         this_obj_conv.inner = untag_ptr(this_obj);
49657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49659         GossipTimestampFilter_free(this_obj_conv);
49660 }
49661
49662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49663         LDKGossipTimestampFilter this_ptr_conv;
49664         this_ptr_conv.inner = untag_ptr(this_ptr);
49665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49667         this_ptr_conv.is_owned = false;
49668         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49669         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
49670         return ret_arr;
49671 }
49672
49673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49674         LDKGossipTimestampFilter this_ptr_conv;
49675         this_ptr_conv.inner = untag_ptr(this_ptr);
49676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49678         this_ptr_conv.is_owned = false;
49679         LDKThirtyTwoBytes val_ref;
49680         CHECK((*env)->GetArrayLength(env, val) == 32);
49681         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49682         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
49683 }
49684
49685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
49686         LDKGossipTimestampFilter this_ptr_conv;
49687         this_ptr_conv.inner = untag_ptr(this_ptr);
49688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49690         this_ptr_conv.is_owned = false;
49691         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
49692         return ret_conv;
49693 }
49694
49695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49696         LDKGossipTimestampFilter this_ptr_conv;
49697         this_ptr_conv.inner = untag_ptr(this_ptr);
49698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49700         this_ptr_conv.is_owned = false;
49701         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
49702 }
49703
49704 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
49705         LDKGossipTimestampFilter this_ptr_conv;
49706         this_ptr_conv.inner = untag_ptr(this_ptr);
49707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49709         this_ptr_conv.is_owned = false;
49710         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
49711         return ret_conv;
49712 }
49713
49714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49715         LDKGossipTimestampFilter this_ptr_conv;
49716         this_ptr_conv.inner = untag_ptr(this_ptr);
49717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49719         this_ptr_conv.is_owned = false;
49720         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
49721 }
49722
49723 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) {
49724         LDKThirtyTwoBytes chain_hash_arg_ref;
49725         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49726         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49727         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
49728         int64_t ret_ref = 0;
49729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49731         return ret_ref;
49732 }
49733
49734 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
49735         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
49736         int64_t ret_ref = 0;
49737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49739         return ret_ref;
49740 }
49741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49742         LDKGossipTimestampFilter arg_conv;
49743         arg_conv.inner = untag_ptr(arg);
49744         arg_conv.is_owned = ptr_is_owned(arg);
49745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49746         arg_conv.is_owned = false;
49747         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
49748         return ret_conv;
49749 }
49750
49751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49752         LDKGossipTimestampFilter orig_conv;
49753         orig_conv.inner = untag_ptr(orig);
49754         orig_conv.is_owned = ptr_is_owned(orig);
49755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49756         orig_conv.is_owned = false;
49757         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
49758         int64_t ret_ref = 0;
49759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49761         return ret_ref;
49762 }
49763
49764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49765         LDKGossipTimestampFilter a_conv;
49766         a_conv.inner = untag_ptr(a);
49767         a_conv.is_owned = ptr_is_owned(a);
49768         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49769         a_conv.is_owned = false;
49770         LDKGossipTimestampFilter b_conv;
49771         b_conv.inner = untag_ptr(b);
49772         b_conv.is_owned = ptr_is_owned(b);
49773         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49774         b_conv.is_owned = false;
49775         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
49776         return ret_conv;
49777 }
49778
49779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49780         if (!ptr_is_owned(this_ptr)) return;
49781         void* this_ptr_ptr = untag_ptr(this_ptr);
49782         CHECK_ACCESS(this_ptr_ptr);
49783         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
49784         FREE(untag_ptr(this_ptr));
49785         ErrorAction_free(this_ptr_conv);
49786 }
49787
49788 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
49789         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49790         *ret_copy = ErrorAction_clone(arg);
49791         int64_t ret_ref = tag_ptr(ret_copy, true);
49792         return ret_ref;
49793 }
49794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49795         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
49796         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
49797         return ret_conv;
49798 }
49799
49800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49801         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
49802         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49803         *ret_copy = ErrorAction_clone(orig_conv);
49804         int64_t ret_ref = tag_ptr(ret_copy, true);
49805         return ret_ref;
49806 }
49807
49808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
49809         LDKErrorMessage msg_conv;
49810         msg_conv.inner = untag_ptr(msg);
49811         msg_conv.is_owned = ptr_is_owned(msg);
49812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49813         msg_conv = ErrorMessage_clone(&msg_conv);
49814         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49815         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
49816         int64_t ret_ref = tag_ptr(ret_copy, true);
49817         return ret_ref;
49818 }
49819
49820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
49821         LDKWarningMessage msg_conv;
49822         msg_conv.inner = untag_ptr(msg);
49823         msg_conv.is_owned = ptr_is_owned(msg);
49824         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49825         msg_conv = WarningMessage_clone(&msg_conv);
49826         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49827         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
49828         int64_t ret_ref = tag_ptr(ret_copy, true);
49829         return ret_ref;
49830 }
49831
49832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
49833         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49834         *ret_copy = ErrorAction_ignore_error();
49835         int64_t ret_ref = tag_ptr(ret_copy, true);
49836         return ret_ref;
49837 }
49838
49839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
49840         LDKLevel a_conv = LDKLevel_from_java(env, a);
49841         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49842         *ret_copy = ErrorAction_ignore_and_log(a_conv);
49843         int64_t ret_ref = tag_ptr(ret_copy, true);
49844         return ret_ref;
49845 }
49846
49847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
49848         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49849         *ret_copy = ErrorAction_ignore_duplicate_gossip();
49850         int64_t ret_ref = tag_ptr(ret_copy, true);
49851         return ret_ref;
49852 }
49853
49854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
49855         LDKErrorMessage msg_conv;
49856         msg_conv.inner = untag_ptr(msg);
49857         msg_conv.is_owned = ptr_is_owned(msg);
49858         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49859         msg_conv = ErrorMessage_clone(&msg_conv);
49860         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49861         *ret_copy = ErrorAction_send_error_message(msg_conv);
49862         int64_t ret_ref = tag_ptr(ret_copy, true);
49863         return ret_ref;
49864 }
49865
49866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
49867         LDKWarningMessage msg_conv;
49868         msg_conv.inner = untag_ptr(msg);
49869         msg_conv.is_owned = ptr_is_owned(msg);
49870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49871         msg_conv = WarningMessage_clone(&msg_conv);
49872         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
49873         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49874         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
49875         int64_t ret_ref = tag_ptr(ret_copy, true);
49876         return ret_ref;
49877 }
49878
49879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49880         LDKLightningError this_obj_conv;
49881         this_obj_conv.inner = untag_ptr(this_obj);
49882         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49884         LightningError_free(this_obj_conv);
49885 }
49886
49887 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
49888         LDKLightningError this_ptr_conv;
49889         this_ptr_conv.inner = untag_ptr(this_ptr);
49890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49892         this_ptr_conv.is_owned = false;
49893         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
49894         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49895         Str_free(ret_str);
49896         return ret_conv;
49897 }
49898
49899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
49900         LDKLightningError this_ptr_conv;
49901         this_ptr_conv.inner = untag_ptr(this_ptr);
49902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49904         this_ptr_conv.is_owned = false;
49905         LDKStr val_conv = java_to_owned_str(env, val);
49906         LightningError_set_err(&this_ptr_conv, val_conv);
49907 }
49908
49909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
49910         LDKLightningError 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         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49916         *ret_copy = LightningError_get_action(&this_ptr_conv);
49917         int64_t ret_ref = tag_ptr(ret_copy, true);
49918         return ret_ref;
49919 }
49920
49921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49922         LDKLightningError this_ptr_conv;
49923         this_ptr_conv.inner = untag_ptr(this_ptr);
49924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49926         this_ptr_conv.is_owned = false;
49927         void* val_ptr = untag_ptr(val);
49928         CHECK_ACCESS(val_ptr);
49929         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
49930         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
49931         LightningError_set_action(&this_ptr_conv, val_conv);
49932 }
49933
49934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
49935         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
49936         void* action_arg_ptr = untag_ptr(action_arg);
49937         CHECK_ACCESS(action_arg_ptr);
49938         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
49939         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
49940         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
49941         int64_t ret_ref = 0;
49942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49944         return ret_ref;
49945 }
49946
49947 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
49948         LDKLightningError ret_var = LightningError_clone(arg);
49949         int64_t ret_ref = 0;
49950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49952         return ret_ref;
49953 }
49954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49955         LDKLightningError arg_conv;
49956         arg_conv.inner = untag_ptr(arg);
49957         arg_conv.is_owned = ptr_is_owned(arg);
49958         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49959         arg_conv.is_owned = false;
49960         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
49961         return ret_conv;
49962 }
49963
49964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49965         LDKLightningError orig_conv;
49966         orig_conv.inner = untag_ptr(orig);
49967         orig_conv.is_owned = ptr_is_owned(orig);
49968         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49969         orig_conv.is_owned = false;
49970         LDKLightningError ret_var = LightningError_clone(&orig_conv);
49971         int64_t ret_ref = 0;
49972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49974         return ret_ref;
49975 }
49976
49977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49978         LDKCommitmentUpdate this_obj_conv;
49979         this_obj_conv.inner = untag_ptr(this_obj);
49980         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49982         CommitmentUpdate_free(this_obj_conv);
49983 }
49984
49985 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
49986         LDKCommitmentUpdate this_ptr_conv;
49987         this_ptr_conv.inner = untag_ptr(this_ptr);
49988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49990         this_ptr_conv.is_owned = false;
49991         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
49992         int64_tArray ret_arr = NULL;
49993         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49994         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49995         for (size_t p = 0; p < ret_var.datalen; p++) {
49996                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
49997                 int64_t ret_conv_15_ref = 0;
49998                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
49999                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50000                 ret_arr_ptr[p] = ret_conv_15_ref;
50001         }
50002         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50003         FREE(ret_var.data);
50004         return ret_arr;
50005 }
50006
50007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50008         LDKCommitmentUpdate 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         LDKCVec_UpdateAddHTLCZ val_constr;
50014         val_constr.datalen = (*env)->GetArrayLength(env, val);
50015         if (val_constr.datalen > 0)
50016                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50017         else
50018                 val_constr.data = NULL;
50019         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50020         for (size_t p = 0; p < val_constr.datalen; p++) {
50021                 int64_t val_conv_15 = val_vals[p];
50022                 LDKUpdateAddHTLC val_conv_15_conv;
50023                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50024                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50025                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50026                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50027                 val_constr.data[p] = val_conv_15_conv;
50028         }
50029         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50030         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50031 }
50032
50033 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50034         LDKCommitmentUpdate this_ptr_conv;
50035         this_ptr_conv.inner = untag_ptr(this_ptr);
50036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50038         this_ptr_conv.is_owned = false;
50039         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50040         int64_tArray ret_arr = NULL;
50041         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50042         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50043         for (size_t t = 0; t < ret_var.datalen; t++) {
50044                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50045                 int64_t ret_conv_19_ref = 0;
50046                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50047                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50048                 ret_arr_ptr[t] = ret_conv_19_ref;
50049         }
50050         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50051         FREE(ret_var.data);
50052         return ret_arr;
50053 }
50054
50055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50056         LDKCommitmentUpdate this_ptr_conv;
50057         this_ptr_conv.inner = untag_ptr(this_ptr);
50058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50060         this_ptr_conv.is_owned = false;
50061         LDKCVec_UpdateFulfillHTLCZ val_constr;
50062         val_constr.datalen = (*env)->GetArrayLength(env, val);
50063         if (val_constr.datalen > 0)
50064                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50065         else
50066                 val_constr.data = NULL;
50067         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50068         for (size_t t = 0; t < val_constr.datalen; t++) {
50069                 int64_t val_conv_19 = val_vals[t];
50070                 LDKUpdateFulfillHTLC val_conv_19_conv;
50071                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50072                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50073                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50074                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50075                 val_constr.data[t] = val_conv_19_conv;
50076         }
50077         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50078         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50079 }
50080
50081 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50082         LDKCommitmentUpdate this_ptr_conv;
50083         this_ptr_conv.inner = untag_ptr(this_ptr);
50084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50086         this_ptr_conv.is_owned = false;
50087         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50088         int64_tArray ret_arr = NULL;
50089         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50090         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50091         for (size_t q = 0; q < ret_var.datalen; q++) {
50092                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50093                 int64_t ret_conv_16_ref = 0;
50094                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50095                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50096                 ret_arr_ptr[q] = ret_conv_16_ref;
50097         }
50098         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50099         FREE(ret_var.data);
50100         return ret_arr;
50101 }
50102
50103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50104         LDKCommitmentUpdate this_ptr_conv;
50105         this_ptr_conv.inner = untag_ptr(this_ptr);
50106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50108         this_ptr_conv.is_owned = false;
50109         LDKCVec_UpdateFailHTLCZ val_constr;
50110         val_constr.datalen = (*env)->GetArrayLength(env, val);
50111         if (val_constr.datalen > 0)
50112                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50113         else
50114                 val_constr.data = NULL;
50115         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50116         for (size_t q = 0; q < val_constr.datalen; q++) {
50117                 int64_t val_conv_16 = val_vals[q];
50118                 LDKUpdateFailHTLC val_conv_16_conv;
50119                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50120                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50121                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50122                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50123                 val_constr.data[q] = val_conv_16_conv;
50124         }
50125         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50126         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50127 }
50128
50129 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50130         LDKCommitmentUpdate this_ptr_conv;
50131         this_ptr_conv.inner = untag_ptr(this_ptr);
50132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50134         this_ptr_conv.is_owned = false;
50135         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50136         int64_tArray ret_arr = NULL;
50137         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50138         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50139         for (size_t z = 0; z < ret_var.datalen; z++) {
50140                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50141                 int64_t ret_conv_25_ref = 0;
50142                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50143                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50144                 ret_arr_ptr[z] = ret_conv_25_ref;
50145         }
50146         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50147         FREE(ret_var.data);
50148         return ret_arr;
50149 }
50150
50151 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) {
50152         LDKCommitmentUpdate this_ptr_conv;
50153         this_ptr_conv.inner = untag_ptr(this_ptr);
50154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50156         this_ptr_conv.is_owned = false;
50157         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50158         val_constr.datalen = (*env)->GetArrayLength(env, val);
50159         if (val_constr.datalen > 0)
50160                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50161         else
50162                 val_constr.data = NULL;
50163         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50164         for (size_t z = 0; z < val_constr.datalen; z++) {
50165                 int64_t val_conv_25 = val_vals[z];
50166                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50167                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50168                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50169                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50170                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50171                 val_constr.data[z] = val_conv_25_conv;
50172         }
50173         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50174         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50175 }
50176
50177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
50178         LDKCommitmentUpdate this_ptr_conv;
50179         this_ptr_conv.inner = untag_ptr(this_ptr);
50180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50182         this_ptr_conv.is_owned = false;
50183         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50184         int64_t ret_ref = 0;
50185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50187         return ret_ref;
50188 }
50189
50190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50191         LDKCommitmentUpdate this_ptr_conv;
50192         this_ptr_conv.inner = untag_ptr(this_ptr);
50193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50195         this_ptr_conv.is_owned = false;
50196         LDKUpdateFee val_conv;
50197         val_conv.inner = untag_ptr(val);
50198         val_conv.is_owned = ptr_is_owned(val);
50199         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50200         val_conv = UpdateFee_clone(&val_conv);
50201         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50202 }
50203
50204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
50205         LDKCommitmentUpdate this_ptr_conv;
50206         this_ptr_conv.inner = untag_ptr(this_ptr);
50207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50209         this_ptr_conv.is_owned = false;
50210         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50211         int64_t ret_ref = 0;
50212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50214         return ret_ref;
50215 }
50216
50217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50218         LDKCommitmentUpdate this_ptr_conv;
50219         this_ptr_conv.inner = untag_ptr(this_ptr);
50220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50222         this_ptr_conv.is_owned = false;
50223         LDKCommitmentSigned val_conv;
50224         val_conv.inner = untag_ptr(val);
50225         val_conv.is_owned = ptr_is_owned(val);
50226         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50227         val_conv = CommitmentSigned_clone(&val_conv);
50228         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50229 }
50230
50231 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) {
50232         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50233         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
50234         if (update_add_htlcs_arg_constr.datalen > 0)
50235                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50236         else
50237                 update_add_htlcs_arg_constr.data = NULL;
50238         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
50239         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50240                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50241                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50242                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50243                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50244                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50245                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50246                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50247         }
50248         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
50249         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50250         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
50251         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50252                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50253         else
50254                 update_fulfill_htlcs_arg_constr.data = NULL;
50255         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
50256         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50257                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50258                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50259                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50260                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50261                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50262                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50263                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50264         }
50265         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
50266         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50267         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
50268         if (update_fail_htlcs_arg_constr.datalen > 0)
50269                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50270         else
50271                 update_fail_htlcs_arg_constr.data = NULL;
50272         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
50273         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50274                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50275                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50276                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50277                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50278                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50279                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50280                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50281         }
50282         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
50283         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50284         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
50285         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50286                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50287         else
50288                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50289         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
50290         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50291                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50292                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50293                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50294                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50295                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50296                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50297                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50298         }
50299         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
50300         LDKUpdateFee update_fee_arg_conv;
50301         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50302         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50303         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50304         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50305         LDKCommitmentSigned commitment_signed_arg_conv;
50306         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50307         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50308         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50309         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50310         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);
50311         int64_t ret_ref = 0;
50312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50314         return ret_ref;
50315 }
50316
50317 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50318         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50319         int64_t ret_ref = 0;
50320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50322         return ret_ref;
50323 }
50324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50325         LDKCommitmentUpdate arg_conv;
50326         arg_conv.inner = untag_ptr(arg);
50327         arg_conv.is_owned = ptr_is_owned(arg);
50328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50329         arg_conv.is_owned = false;
50330         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50331         return ret_conv;
50332 }
50333
50334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50335         LDKCommitmentUpdate orig_conv;
50336         orig_conv.inner = untag_ptr(orig);
50337         orig_conv.is_owned = ptr_is_owned(orig);
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50339         orig_conv.is_owned = false;
50340         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50341         int64_t ret_ref = 0;
50342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50344         return ret_ref;
50345 }
50346
50347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50348         LDKCommitmentUpdate a_conv;
50349         a_conv.inner = untag_ptr(a);
50350         a_conv.is_owned = ptr_is_owned(a);
50351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50352         a_conv.is_owned = false;
50353         LDKCommitmentUpdate b_conv;
50354         b_conv.inner = untag_ptr(b);
50355         b_conv.is_owned = ptr_is_owned(b);
50356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50357         b_conv.is_owned = false;
50358         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
50359         return ret_conv;
50360 }
50361
50362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50363         if (!ptr_is_owned(this_ptr)) return;
50364         void* this_ptr_ptr = untag_ptr(this_ptr);
50365         CHECK_ACCESS(this_ptr_ptr);
50366         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
50367         FREE(untag_ptr(this_ptr));
50368         ChannelMessageHandler_free(this_ptr_conv);
50369 }
50370
50371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50372         if (!ptr_is_owned(this_ptr)) return;
50373         void* this_ptr_ptr = untag_ptr(this_ptr);
50374         CHECK_ACCESS(this_ptr_ptr);
50375         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
50376         FREE(untag_ptr(this_ptr));
50377         RoutingMessageHandler_free(this_ptr_conv);
50378 }
50379
50380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50381         if (!ptr_is_owned(this_ptr)) return;
50382         void* this_ptr_ptr = untag_ptr(this_ptr);
50383         CHECK_ACCESS(this_ptr_ptr);
50384         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
50385         FREE(untag_ptr(this_ptr));
50386         OnionMessageHandler_free(this_ptr_conv);
50387 }
50388
50389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
50390         LDKAcceptChannel obj_conv;
50391         obj_conv.inner = untag_ptr(obj);
50392         obj_conv.is_owned = ptr_is_owned(obj);
50393         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50394         obj_conv.is_owned = false;
50395         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
50396         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50397         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50398         CVec_u8Z_free(ret_var);
50399         return ret_arr;
50400 }
50401
50402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50403         LDKu8slice ser_ref;
50404         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50405         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50406         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
50407         *ret_conv = AcceptChannel_read(ser_ref);
50408         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50409         return tag_ptr(ret_conv, true);
50410 }
50411
50412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
50413         LDKAcceptChannelV2 obj_conv;
50414         obj_conv.inner = untag_ptr(obj);
50415         obj_conv.is_owned = ptr_is_owned(obj);
50416         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50417         obj_conv.is_owned = false;
50418         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
50419         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50420         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50421         CVec_u8Z_free(ret_var);
50422         return ret_arr;
50423 }
50424
50425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50426         LDKu8slice ser_ref;
50427         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50428         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50429         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
50430         *ret_conv = AcceptChannelV2_read(ser_ref);
50431         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50432         return tag_ptr(ret_conv, true);
50433 }
50434
50435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50436         LDKTxAddInput obj_conv;
50437         obj_conv.inner = untag_ptr(obj);
50438         obj_conv.is_owned = ptr_is_owned(obj);
50439         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50440         obj_conv.is_owned = false;
50441         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
50442         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50443         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50444         CVec_u8Z_free(ret_var);
50445         return ret_arr;
50446 }
50447
50448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50449         LDKu8slice ser_ref;
50450         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50451         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50452         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
50453         *ret_conv = TxAddInput_read(ser_ref);
50454         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50455         return tag_ptr(ret_conv, true);
50456 }
50457
50458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50459         LDKTxAddOutput obj_conv;
50460         obj_conv.inner = untag_ptr(obj);
50461         obj_conv.is_owned = ptr_is_owned(obj);
50462         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50463         obj_conv.is_owned = false;
50464         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
50465         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50466         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50467         CVec_u8Z_free(ret_var);
50468         return ret_arr;
50469 }
50470
50471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50472         LDKu8slice ser_ref;
50473         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50474         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50475         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
50476         *ret_conv = TxAddOutput_read(ser_ref);
50477         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50478         return tag_ptr(ret_conv, true);
50479 }
50480
50481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50482         LDKTxRemoveInput obj_conv;
50483         obj_conv.inner = untag_ptr(obj);
50484         obj_conv.is_owned = ptr_is_owned(obj);
50485         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50486         obj_conv.is_owned = false;
50487         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
50488         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50489         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50490         CVec_u8Z_free(ret_var);
50491         return ret_arr;
50492 }
50493
50494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50495         LDKu8slice ser_ref;
50496         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50497         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50498         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
50499         *ret_conv = TxRemoveInput_read(ser_ref);
50500         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50501         return tag_ptr(ret_conv, true);
50502 }
50503
50504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50505         LDKTxRemoveOutput obj_conv;
50506         obj_conv.inner = untag_ptr(obj);
50507         obj_conv.is_owned = ptr_is_owned(obj);
50508         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50509         obj_conv.is_owned = false;
50510         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
50511         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50512         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50513         CVec_u8Z_free(ret_var);
50514         return ret_arr;
50515 }
50516
50517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50518         LDKu8slice ser_ref;
50519         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50520         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50521         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
50522         *ret_conv = TxRemoveOutput_read(ser_ref);
50523         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50524         return tag_ptr(ret_conv, true);
50525 }
50526
50527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
50528         LDKTxComplete obj_conv;
50529         obj_conv.inner = untag_ptr(obj);
50530         obj_conv.is_owned = ptr_is_owned(obj);
50531         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50532         obj_conv.is_owned = false;
50533         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
50534         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50535         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50536         CVec_u8Z_free(ret_var);
50537         return ret_arr;
50538 }
50539
50540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50541         LDKu8slice ser_ref;
50542         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50543         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50544         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
50545         *ret_conv = TxComplete_read(ser_ref);
50546         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50547         return tag_ptr(ret_conv, true);
50548 }
50549
50550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
50551         LDKTxSignatures obj_conv;
50552         obj_conv.inner = untag_ptr(obj);
50553         obj_conv.is_owned = ptr_is_owned(obj);
50554         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50555         obj_conv.is_owned = false;
50556         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
50557         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50558         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50559         CVec_u8Z_free(ret_var);
50560         return ret_arr;
50561 }
50562
50563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50564         LDKu8slice ser_ref;
50565         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50566         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50567         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
50568         *ret_conv = TxSignatures_read(ser_ref);
50569         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50570         return tag_ptr(ret_conv, true);
50571 }
50572
50573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
50574         LDKTxInitRbf obj_conv;
50575         obj_conv.inner = untag_ptr(obj);
50576         obj_conv.is_owned = ptr_is_owned(obj);
50577         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50578         obj_conv.is_owned = false;
50579         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
50580         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50581         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50582         CVec_u8Z_free(ret_var);
50583         return ret_arr;
50584 }
50585
50586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50587         LDKu8slice ser_ref;
50588         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50589         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50590         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
50591         *ret_conv = TxInitRbf_read(ser_ref);
50592         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50593         return tag_ptr(ret_conv, true);
50594 }
50595
50596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
50597         LDKTxAckRbf obj_conv;
50598         obj_conv.inner = untag_ptr(obj);
50599         obj_conv.is_owned = ptr_is_owned(obj);
50600         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50601         obj_conv.is_owned = false;
50602         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
50603         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50604         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50605         CVec_u8Z_free(ret_var);
50606         return ret_arr;
50607 }
50608
50609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50610         LDKu8slice ser_ref;
50611         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50612         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50613         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
50614         *ret_conv = TxAckRbf_read(ser_ref);
50615         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50616         return tag_ptr(ret_conv, true);
50617 }
50618
50619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
50620         LDKTxAbort obj_conv;
50621         obj_conv.inner = untag_ptr(obj);
50622         obj_conv.is_owned = ptr_is_owned(obj);
50623         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50624         obj_conv.is_owned = false;
50625         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
50626         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50627         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50628         CVec_u8Z_free(ret_var);
50629         return ret_arr;
50630 }
50631
50632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50633         LDKu8slice ser_ref;
50634         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50635         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50636         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
50637         *ret_conv = TxAbort_read(ser_ref);
50638         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50639         return tag_ptr(ret_conv, true);
50640 }
50641
50642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
50643         LDKAnnouncementSignatures obj_conv;
50644         obj_conv.inner = untag_ptr(obj);
50645         obj_conv.is_owned = ptr_is_owned(obj);
50646         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50647         obj_conv.is_owned = false;
50648         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
50649         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50650         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50651         CVec_u8Z_free(ret_var);
50652         return ret_arr;
50653 }
50654
50655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50656         LDKu8slice ser_ref;
50657         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50658         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50659         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
50660         *ret_conv = AnnouncementSignatures_read(ser_ref);
50661         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50662         return tag_ptr(ret_conv, true);
50663 }
50664
50665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
50666         LDKChannelReestablish obj_conv;
50667         obj_conv.inner = untag_ptr(obj);
50668         obj_conv.is_owned = ptr_is_owned(obj);
50669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50670         obj_conv.is_owned = false;
50671         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
50672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50674         CVec_u8Z_free(ret_var);
50675         return ret_arr;
50676 }
50677
50678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50679         LDKu8slice ser_ref;
50680         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50681         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50682         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
50683         *ret_conv = ChannelReestablish_read(ser_ref);
50684         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50685         return tag_ptr(ret_conv, true);
50686 }
50687
50688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
50689         LDKClosingSigned obj_conv;
50690         obj_conv.inner = untag_ptr(obj);
50691         obj_conv.is_owned = ptr_is_owned(obj);
50692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50693         obj_conv.is_owned = false;
50694         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
50695         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50696         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50697         CVec_u8Z_free(ret_var);
50698         return ret_arr;
50699 }
50700
50701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50702         LDKu8slice ser_ref;
50703         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50704         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50705         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
50706         *ret_conv = ClosingSigned_read(ser_ref);
50707         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50708         return tag_ptr(ret_conv, true);
50709 }
50710
50711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
50712         LDKClosingSignedFeeRange obj_conv;
50713         obj_conv.inner = untag_ptr(obj);
50714         obj_conv.is_owned = ptr_is_owned(obj);
50715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50716         obj_conv.is_owned = false;
50717         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
50718         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50719         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50720         CVec_u8Z_free(ret_var);
50721         return ret_arr;
50722 }
50723
50724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50725         LDKu8slice ser_ref;
50726         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50727         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50728         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
50729         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
50730         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50731         return tag_ptr(ret_conv, true);
50732 }
50733
50734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
50735         LDKCommitmentSigned obj_conv;
50736         obj_conv.inner = untag_ptr(obj);
50737         obj_conv.is_owned = ptr_is_owned(obj);
50738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50739         obj_conv.is_owned = false;
50740         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
50741         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50742         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50743         CVec_u8Z_free(ret_var);
50744         return ret_arr;
50745 }
50746
50747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50748         LDKu8slice ser_ref;
50749         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50750         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50751         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
50752         *ret_conv = CommitmentSigned_read(ser_ref);
50753         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50754         return tag_ptr(ret_conv, true);
50755 }
50756
50757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
50758         LDKFundingCreated obj_conv;
50759         obj_conv.inner = untag_ptr(obj);
50760         obj_conv.is_owned = ptr_is_owned(obj);
50761         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50762         obj_conv.is_owned = false;
50763         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
50764         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50765         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50766         CVec_u8Z_free(ret_var);
50767         return ret_arr;
50768 }
50769
50770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50771         LDKu8slice ser_ref;
50772         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50773         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50774         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
50775         *ret_conv = FundingCreated_read(ser_ref);
50776         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50777         return tag_ptr(ret_conv, true);
50778 }
50779
50780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
50781         LDKFundingSigned obj_conv;
50782         obj_conv.inner = untag_ptr(obj);
50783         obj_conv.is_owned = ptr_is_owned(obj);
50784         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50785         obj_conv.is_owned = false;
50786         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
50787         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50788         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50789         CVec_u8Z_free(ret_var);
50790         return ret_arr;
50791 }
50792
50793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50794         LDKu8slice ser_ref;
50795         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50796         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50797         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
50798         *ret_conv = FundingSigned_read(ser_ref);
50799         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50800         return tag_ptr(ret_conv, true);
50801 }
50802
50803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
50804         LDKChannelReady obj_conv;
50805         obj_conv.inner = untag_ptr(obj);
50806         obj_conv.is_owned = ptr_is_owned(obj);
50807         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50808         obj_conv.is_owned = false;
50809         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
50810         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50811         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50812         CVec_u8Z_free(ret_var);
50813         return ret_arr;
50814 }
50815
50816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50817         LDKu8slice ser_ref;
50818         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50819         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50820         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
50821         *ret_conv = ChannelReady_read(ser_ref);
50822         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50823         return tag_ptr(ret_conv, true);
50824 }
50825
50826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
50827         LDKInit obj_conv;
50828         obj_conv.inner = untag_ptr(obj);
50829         obj_conv.is_owned = ptr_is_owned(obj);
50830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50831         obj_conv.is_owned = false;
50832         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
50833         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50834         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50835         CVec_u8Z_free(ret_var);
50836         return ret_arr;
50837 }
50838
50839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50840         LDKu8slice ser_ref;
50841         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50842         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50843         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
50844         *ret_conv = Init_read(ser_ref);
50845         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50846         return tag_ptr(ret_conv, true);
50847 }
50848
50849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
50850         LDKOpenChannel obj_conv;
50851         obj_conv.inner = untag_ptr(obj);
50852         obj_conv.is_owned = ptr_is_owned(obj);
50853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50854         obj_conv.is_owned = false;
50855         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
50856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50858         CVec_u8Z_free(ret_var);
50859         return ret_arr;
50860 }
50861
50862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50863         LDKu8slice ser_ref;
50864         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50865         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50866         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
50867         *ret_conv = OpenChannel_read(ser_ref);
50868         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50869         return tag_ptr(ret_conv, true);
50870 }
50871
50872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
50873         LDKOpenChannelV2 obj_conv;
50874         obj_conv.inner = untag_ptr(obj);
50875         obj_conv.is_owned = ptr_is_owned(obj);
50876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50877         obj_conv.is_owned = false;
50878         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
50879         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50880         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50881         CVec_u8Z_free(ret_var);
50882         return ret_arr;
50883 }
50884
50885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50886         LDKu8slice ser_ref;
50887         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50888         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50889         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
50890         *ret_conv = OpenChannelV2_read(ser_ref);
50891         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50892         return tag_ptr(ret_conv, true);
50893 }
50894
50895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
50896         LDKRevokeAndACK obj_conv;
50897         obj_conv.inner = untag_ptr(obj);
50898         obj_conv.is_owned = ptr_is_owned(obj);
50899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50900         obj_conv.is_owned = false;
50901         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
50902         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50903         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50904         CVec_u8Z_free(ret_var);
50905         return ret_arr;
50906 }
50907
50908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50909         LDKu8slice ser_ref;
50910         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50911         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50912         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
50913         *ret_conv = RevokeAndACK_read(ser_ref);
50914         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50915         return tag_ptr(ret_conv, true);
50916 }
50917
50918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
50919         LDKShutdown obj_conv;
50920         obj_conv.inner = untag_ptr(obj);
50921         obj_conv.is_owned = ptr_is_owned(obj);
50922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50923         obj_conv.is_owned = false;
50924         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
50925         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50926         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50927         CVec_u8Z_free(ret_var);
50928         return ret_arr;
50929 }
50930
50931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50932         LDKu8slice ser_ref;
50933         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50934         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50935         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
50936         *ret_conv = Shutdown_read(ser_ref);
50937         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50938         return tag_ptr(ret_conv, true);
50939 }
50940
50941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
50942         LDKUpdateFailHTLC obj_conv;
50943         obj_conv.inner = untag_ptr(obj);
50944         obj_conv.is_owned = ptr_is_owned(obj);
50945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50946         obj_conv.is_owned = false;
50947         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
50948         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50949         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50950         CVec_u8Z_free(ret_var);
50951         return ret_arr;
50952 }
50953
50954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50955         LDKu8slice ser_ref;
50956         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50957         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50958         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
50959         *ret_conv = UpdateFailHTLC_read(ser_ref);
50960         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50961         return tag_ptr(ret_conv, true);
50962 }
50963
50964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
50965         LDKUpdateFailMalformedHTLC obj_conv;
50966         obj_conv.inner = untag_ptr(obj);
50967         obj_conv.is_owned = ptr_is_owned(obj);
50968         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50969         obj_conv.is_owned = false;
50970         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
50971         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50972         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50973         CVec_u8Z_free(ret_var);
50974         return ret_arr;
50975 }
50976
50977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50978         LDKu8slice ser_ref;
50979         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50980         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50981         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
50982         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
50983         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50984         return tag_ptr(ret_conv, true);
50985 }
50986
50987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
50988         LDKUpdateFee obj_conv;
50989         obj_conv.inner = untag_ptr(obj);
50990         obj_conv.is_owned = ptr_is_owned(obj);
50991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50992         obj_conv.is_owned = false;
50993         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
50994         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50995         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50996         CVec_u8Z_free(ret_var);
50997         return ret_arr;
50998 }
50999
51000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51001         LDKu8slice ser_ref;
51002         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51003         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51004         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51005         *ret_conv = UpdateFee_read(ser_ref);
51006         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51007         return tag_ptr(ret_conv, true);
51008 }
51009
51010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51011         LDKUpdateFulfillHTLC obj_conv;
51012         obj_conv.inner = untag_ptr(obj);
51013         obj_conv.is_owned = ptr_is_owned(obj);
51014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51015         obj_conv.is_owned = false;
51016         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51019         CVec_u8Z_free(ret_var);
51020         return ret_arr;
51021 }
51022
51023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51024         LDKu8slice ser_ref;
51025         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51026         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51027         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51028         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51029         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51030         return tag_ptr(ret_conv, true);
51031 }
51032
51033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51034         LDKUpdateAddHTLC obj_conv;
51035         obj_conv.inner = untag_ptr(obj);
51036         obj_conv.is_owned = ptr_is_owned(obj);
51037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51038         obj_conv.is_owned = false;
51039         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51042         CVec_u8Z_free(ret_var);
51043         return ret_arr;
51044 }
51045
51046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51047         LDKu8slice ser_ref;
51048         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51049         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51050         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51051         *ret_conv = UpdateAddHTLC_read(ser_ref);
51052         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51053         return tag_ptr(ret_conv, true);
51054 }
51055
51056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51057         LDKu8slice ser_ref;
51058         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51059         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51060         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51061         *ret_conv = OnionMessage_read(ser_ref);
51062         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51063         return tag_ptr(ret_conv, true);
51064 }
51065
51066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51067         LDKOnionMessage obj_conv;
51068         obj_conv.inner = untag_ptr(obj);
51069         obj_conv.is_owned = ptr_is_owned(obj);
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51071         obj_conv.is_owned = false;
51072         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51073         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51074         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51075         CVec_u8Z_free(ret_var);
51076         return ret_arr;
51077 }
51078
51079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
51080         LDKPing obj_conv;
51081         obj_conv.inner = untag_ptr(obj);
51082         obj_conv.is_owned = ptr_is_owned(obj);
51083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51084         obj_conv.is_owned = false;
51085         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51088         CVec_u8Z_free(ret_var);
51089         return ret_arr;
51090 }
51091
51092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51093         LDKu8slice ser_ref;
51094         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51095         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51096         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51097         *ret_conv = Ping_read(ser_ref);
51098         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51099         return tag_ptr(ret_conv, true);
51100 }
51101
51102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
51103         LDKPong obj_conv;
51104         obj_conv.inner = untag_ptr(obj);
51105         obj_conv.is_owned = ptr_is_owned(obj);
51106         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51107         obj_conv.is_owned = false;
51108         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51109         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51110         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51111         CVec_u8Z_free(ret_var);
51112         return ret_arr;
51113 }
51114
51115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51116         LDKu8slice ser_ref;
51117         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51118         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51119         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51120         *ret_conv = Pong_read(ser_ref);
51121         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51122         return tag_ptr(ret_conv, true);
51123 }
51124
51125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51126         LDKUnsignedChannelAnnouncement obj_conv;
51127         obj_conv.inner = untag_ptr(obj);
51128         obj_conv.is_owned = ptr_is_owned(obj);
51129         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51130         obj_conv.is_owned = false;
51131         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51132         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51133         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51134         CVec_u8Z_free(ret_var);
51135         return ret_arr;
51136 }
51137
51138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51139         LDKu8slice ser_ref;
51140         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51141         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51142         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51143         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51144         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51145         return tag_ptr(ret_conv, true);
51146 }
51147
51148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51149         LDKChannelAnnouncement obj_conv;
51150         obj_conv.inner = untag_ptr(obj);
51151         obj_conv.is_owned = ptr_is_owned(obj);
51152         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51153         obj_conv.is_owned = false;
51154         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51155         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51156         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51157         CVec_u8Z_free(ret_var);
51158         return ret_arr;
51159 }
51160
51161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51162         LDKu8slice ser_ref;
51163         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51164         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51165         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51166         *ret_conv = ChannelAnnouncement_read(ser_ref);
51167         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51168         return tag_ptr(ret_conv, true);
51169 }
51170
51171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51172         LDKUnsignedChannelUpdate obj_conv;
51173         obj_conv.inner = untag_ptr(obj);
51174         obj_conv.is_owned = ptr_is_owned(obj);
51175         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51176         obj_conv.is_owned = false;
51177         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51178         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51179         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51180         CVec_u8Z_free(ret_var);
51181         return ret_arr;
51182 }
51183
51184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51185         LDKu8slice ser_ref;
51186         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51187         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51188         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
51189         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
51190         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51191         return tag_ptr(ret_conv, true);
51192 }
51193
51194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51195         LDKChannelUpdate obj_conv;
51196         obj_conv.inner = untag_ptr(obj);
51197         obj_conv.is_owned = ptr_is_owned(obj);
51198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51199         obj_conv.is_owned = false;
51200         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
51201         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51202         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51203         CVec_u8Z_free(ret_var);
51204         return ret_arr;
51205 }
51206
51207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51208         LDKu8slice ser_ref;
51209         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51210         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51211         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
51212         *ret_conv = ChannelUpdate_read(ser_ref);
51213         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51214         return tag_ptr(ret_conv, true);
51215 }
51216
51217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51218         LDKErrorMessage obj_conv;
51219         obj_conv.inner = untag_ptr(obj);
51220         obj_conv.is_owned = ptr_is_owned(obj);
51221         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51222         obj_conv.is_owned = false;
51223         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
51224         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51225         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51226         CVec_u8Z_free(ret_var);
51227         return ret_arr;
51228 }
51229
51230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51231         LDKu8slice ser_ref;
51232         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51233         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51234         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
51235         *ret_conv = ErrorMessage_read(ser_ref);
51236         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51237         return tag_ptr(ret_conv, true);
51238 }
51239
51240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51241         LDKWarningMessage obj_conv;
51242         obj_conv.inner = untag_ptr(obj);
51243         obj_conv.is_owned = ptr_is_owned(obj);
51244         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51245         obj_conv.is_owned = false;
51246         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
51247         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51248         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51249         CVec_u8Z_free(ret_var);
51250         return ret_arr;
51251 }
51252
51253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51254         LDKu8slice ser_ref;
51255         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51256         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51257         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
51258         *ret_conv = WarningMessage_read(ser_ref);
51259         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51260         return tag_ptr(ret_conv, true);
51261 }
51262
51263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51264         LDKUnsignedNodeAnnouncement obj_conv;
51265         obj_conv.inner = untag_ptr(obj);
51266         obj_conv.is_owned = ptr_is_owned(obj);
51267         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51268         obj_conv.is_owned = false;
51269         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
51270         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51271         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51272         CVec_u8Z_free(ret_var);
51273         return ret_arr;
51274 }
51275
51276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51277         LDKu8slice ser_ref;
51278         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51279         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51280         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
51281         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
51282         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51283         return tag_ptr(ret_conv, true);
51284 }
51285
51286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51287         LDKNodeAnnouncement obj_conv;
51288         obj_conv.inner = untag_ptr(obj);
51289         obj_conv.is_owned = ptr_is_owned(obj);
51290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51291         obj_conv.is_owned = false;
51292         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
51293         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51294         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51295         CVec_u8Z_free(ret_var);
51296         return ret_arr;
51297 }
51298
51299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51300         LDKu8slice ser_ref;
51301         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51302         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51303         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
51304         *ret_conv = NodeAnnouncement_read(ser_ref);
51305         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51306         return tag_ptr(ret_conv, true);
51307 }
51308
51309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51310         LDKu8slice ser_ref;
51311         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51312         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51313         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
51314         *ret_conv = QueryShortChannelIds_read(ser_ref);
51315         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51316         return tag_ptr(ret_conv, true);
51317 }
51318
51319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
51320         LDKQueryShortChannelIds obj_conv;
51321         obj_conv.inner = untag_ptr(obj);
51322         obj_conv.is_owned = ptr_is_owned(obj);
51323         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51324         obj_conv.is_owned = false;
51325         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
51326         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51327         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51328         CVec_u8Z_free(ret_var);
51329         return ret_arr;
51330 }
51331
51332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
51333         LDKReplyShortChannelIdsEnd obj_conv;
51334         obj_conv.inner = untag_ptr(obj);
51335         obj_conv.is_owned = ptr_is_owned(obj);
51336         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51337         obj_conv.is_owned = false;
51338         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
51339         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51340         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51341         CVec_u8Z_free(ret_var);
51342         return ret_arr;
51343 }
51344
51345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51346         LDKu8slice ser_ref;
51347         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51348         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51349         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
51350         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
51351         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51352         return tag_ptr(ret_conv, true);
51353 }
51354
51355 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
51356         LDKQueryChannelRange this_arg_conv;
51357         this_arg_conv.inner = untag_ptr(this_arg);
51358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51360         this_arg_conv.is_owned = false;
51361         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
51362         return ret_conv;
51363 }
51364
51365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
51366         LDKQueryChannelRange obj_conv;
51367         obj_conv.inner = untag_ptr(obj);
51368         obj_conv.is_owned = ptr_is_owned(obj);
51369         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51370         obj_conv.is_owned = false;
51371         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
51372         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51373         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51374         CVec_u8Z_free(ret_var);
51375         return ret_arr;
51376 }
51377
51378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51379         LDKu8slice ser_ref;
51380         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51381         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51382         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
51383         *ret_conv = QueryChannelRange_read(ser_ref);
51384         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51385         return tag_ptr(ret_conv, true);
51386 }
51387
51388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51389         LDKu8slice ser_ref;
51390         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51391         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51392         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
51393         *ret_conv = ReplyChannelRange_read(ser_ref);
51394         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51395         return tag_ptr(ret_conv, true);
51396 }
51397
51398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
51399         LDKReplyChannelRange obj_conv;
51400         obj_conv.inner = untag_ptr(obj);
51401         obj_conv.is_owned = ptr_is_owned(obj);
51402         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51403         obj_conv.is_owned = false;
51404         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
51405         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51406         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51407         CVec_u8Z_free(ret_var);
51408         return ret_arr;
51409 }
51410
51411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
51412         LDKGossipTimestampFilter obj_conv;
51413         obj_conv.inner = untag_ptr(obj);
51414         obj_conv.is_owned = ptr_is_owned(obj);
51415         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51416         obj_conv.is_owned = false;
51417         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
51418         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51419         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51420         CVec_u8Z_free(ret_var);
51421         return ret_arr;
51422 }
51423
51424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51425         LDKu8slice ser_ref;
51426         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51427         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51428         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
51429         *ret_conv = GossipTimestampFilter_read(ser_ref);
51430         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51431         return tag_ptr(ret_conv, true);
51432 }
51433
51434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51435         if (!ptr_is_owned(this_ptr)) return;
51436         void* this_ptr_ptr = untag_ptr(this_ptr);
51437         CHECK_ACCESS(this_ptr_ptr);
51438         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
51439         FREE(untag_ptr(this_ptr));
51440         CustomMessageHandler_free(this_ptr_conv);
51441 }
51442
51443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51444         LDKIgnoringMessageHandler this_obj_conv;
51445         this_obj_conv.inner = untag_ptr(this_obj);
51446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51448         IgnoringMessageHandler_free(this_obj_conv);
51449 }
51450
51451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
51452         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
51453         int64_t ret_ref = 0;
51454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51456         return ret_ref;
51457 }
51458
51459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
51460         LDKIgnoringMessageHandler this_arg_conv;
51461         this_arg_conv.inner = untag_ptr(this_arg);
51462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51464         this_arg_conv.is_owned = false;
51465         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51466         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51467         return tag_ptr(ret_ret, true);
51468 }
51469
51470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51471         LDKIgnoringMessageHandler this_arg_conv;
51472         this_arg_conv.inner = untag_ptr(this_arg);
51473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51475         this_arg_conv.is_owned = false;
51476         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
51477         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
51478         return tag_ptr(ret_ret, true);
51479 }
51480
51481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
51482         LDKIgnoringMessageHandler this_arg_conv;
51483         this_arg_conv.inner = untag_ptr(this_arg);
51484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51486         this_arg_conv.is_owned = false;
51487         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
51488         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
51489         return tag_ptr(ret_ret, true);
51490 }
51491
51492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51493         LDKIgnoringMessageHandler this_arg_conv;
51494         this_arg_conv.inner = untag_ptr(this_arg);
51495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51497         this_arg_conv.is_owned = false;
51498         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
51499         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
51500         return tag_ptr(ret_ret, true);
51501 }
51502
51503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51504         LDKIgnoringMessageHandler this_arg_conv;
51505         this_arg_conv.inner = untag_ptr(this_arg);
51506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51508         this_arg_conv.is_owned = false;
51509         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
51510         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
51511         return tag_ptr(ret_ret, true);
51512 }
51513
51514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51515         LDKIgnoringMessageHandler this_arg_conv;
51516         this_arg_conv.inner = untag_ptr(this_arg);
51517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51519         this_arg_conv.is_owned = false;
51520         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
51521         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
51522         return tag_ptr(ret_ret, true);
51523 }
51524
51525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
51526         LDKIgnoringMessageHandler this_arg_conv;
51527         this_arg_conv.inner = untag_ptr(this_arg);
51528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51530         this_arg_conv.is_owned = false;
51531         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
51532         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
51533         return tag_ptr(ret_ret, true);
51534 }
51535
51536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51537         LDKIgnoringMessageHandler this_arg_conv;
51538         this_arg_conv.inner = untag_ptr(this_arg);
51539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51541         this_arg_conv.is_owned = false;
51542         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
51543         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
51544         return tag_ptr(ret_ret, true);
51545 }
51546
51547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51548         LDKErroringMessageHandler this_obj_conv;
51549         this_obj_conv.inner = untag_ptr(this_obj);
51550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51552         ErroringMessageHandler_free(this_obj_conv);
51553 }
51554
51555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
51556         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
51557         int64_t ret_ref = 0;
51558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51560         return ret_ref;
51561 }
51562
51563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
51564         LDKErroringMessageHandler this_arg_conv;
51565         this_arg_conv.inner = untag_ptr(this_arg);
51566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51568         this_arg_conv.is_owned = false;
51569         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51570         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51571         return tag_ptr(ret_ret, true);
51572 }
51573
51574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51575         LDKErroringMessageHandler this_arg_conv;
51576         this_arg_conv.inner = untag_ptr(this_arg);
51577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51579         this_arg_conv.is_owned = false;
51580         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
51581         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
51582         return tag_ptr(ret_ret, true);
51583 }
51584
51585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51586         LDKMessageHandler this_obj_conv;
51587         this_obj_conv.inner = untag_ptr(this_obj);
51588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51590         MessageHandler_free(this_obj_conv);
51591 }
51592
51593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51594         LDKMessageHandler this_ptr_conv;
51595         this_ptr_conv.inner = untag_ptr(this_ptr);
51596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51598         this_ptr_conv.is_owned = false;
51599         // WARNING: This object doesn't live past this scope, needs clone!
51600         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
51601         return ret_ret;
51602 }
51603
51604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51605         LDKMessageHandler this_ptr_conv;
51606         this_ptr_conv.inner = untag_ptr(this_ptr);
51607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51609         this_ptr_conv.is_owned = false;
51610         void* val_ptr = untag_ptr(val);
51611         CHECK_ACCESS(val_ptr);
51612         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
51613         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
51614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51615                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
51616         }
51617         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
51618 }
51619
51620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51621         LDKMessageHandler this_ptr_conv;
51622         this_ptr_conv.inner = untag_ptr(this_ptr);
51623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51625         this_ptr_conv.is_owned = false;
51626         // WARNING: This object doesn't live past this scope, needs clone!
51627         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
51628         return ret_ret;
51629 }
51630
51631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51632         LDKMessageHandler this_ptr_conv;
51633         this_ptr_conv.inner = untag_ptr(this_ptr);
51634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51636         this_ptr_conv.is_owned = false;
51637         void* val_ptr = untag_ptr(val);
51638         CHECK_ACCESS(val_ptr);
51639         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
51640         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
51641                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51642                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
51643         }
51644         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
51645 }
51646
51647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51648         LDKMessageHandler this_ptr_conv;
51649         this_ptr_conv.inner = untag_ptr(this_ptr);
51650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51652         this_ptr_conv.is_owned = false;
51653         // WARNING: This object doesn't live past this scope, needs clone!
51654         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
51655         return ret_ret;
51656 }
51657
51658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51659         LDKMessageHandler this_ptr_conv;
51660         this_ptr_conv.inner = untag_ptr(this_ptr);
51661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51663         this_ptr_conv.is_owned = false;
51664         void* val_ptr = untag_ptr(val);
51665         CHECK_ACCESS(val_ptr);
51666         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
51667         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
51668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51669                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
51670         }
51671         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
51672 }
51673
51674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51675         LDKMessageHandler this_ptr_conv;
51676         this_ptr_conv.inner = untag_ptr(this_ptr);
51677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51679         this_ptr_conv.is_owned = false;
51680         // WARNING: This object doesn't live past this scope, needs clone!
51681         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
51682         return ret_ret;
51683 }
51684
51685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51686         LDKMessageHandler this_ptr_conv;
51687         this_ptr_conv.inner = untag_ptr(this_ptr);
51688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51690         this_ptr_conv.is_owned = false;
51691         void* val_ptr = untag_ptr(val);
51692         CHECK_ACCESS(val_ptr);
51693         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
51694         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
51695                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51696                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
51697         }
51698         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
51699 }
51700
51701 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) {
51702         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
51703         CHECK_ACCESS(chan_handler_arg_ptr);
51704         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
51705         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
51706                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51707                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
51708         }
51709         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
51710         CHECK_ACCESS(route_handler_arg_ptr);
51711         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
51712         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
51713                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51714                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
51715         }
51716         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
51717         CHECK_ACCESS(onion_message_handler_arg_ptr);
51718         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
51719         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
51720                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51721                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
51722         }
51723         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
51724         CHECK_ACCESS(custom_message_handler_arg_ptr);
51725         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
51726         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
51727                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51728                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
51729         }
51730         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
51731         int64_t ret_ref = 0;
51732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51734         return ret_ref;
51735 }
51736
51737 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
51738         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
51739         *ret_ret = SocketDescriptor_clone(arg);
51740         return tag_ptr(ret_ret, true);
51741 }
51742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51743         void* arg_ptr = untag_ptr(arg);
51744         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
51745         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
51746         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
51747         return ret_conv;
51748 }
51749
51750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51751         void* orig_ptr = untag_ptr(orig);
51752         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
51753         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
51754         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
51755         *ret_ret = SocketDescriptor_clone(orig_conv);
51756         return tag_ptr(ret_ret, true);
51757 }
51758
51759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51760         if (!ptr_is_owned(this_ptr)) return;
51761         void* this_ptr_ptr = untag_ptr(this_ptr);
51762         CHECK_ACCESS(this_ptr_ptr);
51763         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
51764         FREE(untag_ptr(this_ptr));
51765         SocketDescriptor_free(this_ptr_conv);
51766 }
51767
51768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51769         LDKPeerHandleError this_obj_conv;
51770         this_obj_conv.inner = untag_ptr(this_obj);
51771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51773         PeerHandleError_free(this_obj_conv);
51774 }
51775
51776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
51777         LDKPeerHandleError ret_var = PeerHandleError_new();
51778         int64_t ret_ref = 0;
51779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51781         return ret_ref;
51782 }
51783
51784 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
51785         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
51786         int64_t ret_ref = 0;
51787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51789         return ret_ref;
51790 }
51791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51792         LDKPeerHandleError arg_conv;
51793         arg_conv.inner = untag_ptr(arg);
51794         arg_conv.is_owned = ptr_is_owned(arg);
51795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51796         arg_conv.is_owned = false;
51797         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
51798         return ret_conv;
51799 }
51800
51801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51802         LDKPeerHandleError orig_conv;
51803         orig_conv.inner = untag_ptr(orig);
51804         orig_conv.is_owned = ptr_is_owned(orig);
51805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51806         orig_conv.is_owned = false;
51807         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
51808         int64_t ret_ref = 0;
51809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51811         return ret_ref;
51812 }
51813
51814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51815         LDKPeerManager this_obj_conv;
51816         this_obj_conv.inner = untag_ptr(this_obj);
51817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51819         PeerManager_free(this_obj_conv);
51820 }
51821
51822 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) {
51823         LDKMessageHandler message_handler_conv;
51824         message_handler_conv.inner = untag_ptr(message_handler);
51825         message_handler_conv.is_owned = ptr_is_owned(message_handler);
51826         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
51827         // WARNING: we need a move here but no clone is available for LDKMessageHandler
51828         
51829         uint8_t ephemeral_random_data_arr[32];
51830         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
51831         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
51832         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
51833         void* logger_ptr = untag_ptr(logger);
51834         CHECK_ACCESS(logger_ptr);
51835         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
51836         if (logger_conv.free == LDKLogger_JCalls_free) {
51837                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51838                 LDKLogger_JCalls_cloned(&logger_conv);
51839         }
51840         void* node_signer_ptr = untag_ptr(node_signer);
51841         CHECK_ACCESS(node_signer_ptr);
51842         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
51843         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
51844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51845                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
51846         }
51847         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
51848         int64_t ret_ref = 0;
51849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51851         return ret_ref;
51852 }
51853
51854 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
51855         LDKPeerManager this_arg_conv;
51856         this_arg_conv.inner = untag_ptr(this_arg);
51857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51859         this_arg_conv.is_owned = false;
51860         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
51861         int64_tArray ret_arr = NULL;
51862         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
51863         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
51864         for (size_t r = 0; r < ret_var.datalen; r++) {
51865                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
51866                 *ret_conv_43_conv = ret_var.data[r];
51867                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
51868         }
51869         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
51870         FREE(ret_var.data);
51871         return ret_arr;
51872 }
51873
51874 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) {
51875         LDKPeerManager this_arg_conv;
51876         this_arg_conv.inner = untag_ptr(this_arg);
51877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51879         this_arg_conv.is_owned = false;
51880         LDKPublicKey their_node_id_ref;
51881         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
51882         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
51883         void* descriptor_ptr = untag_ptr(descriptor);
51884         CHECK_ACCESS(descriptor_ptr);
51885         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
51886         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
51887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51888                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
51889         }
51890         void* remote_network_address_ptr = untag_ptr(remote_network_address);
51891         CHECK_ACCESS(remote_network_address_ptr);
51892         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
51893         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
51894         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
51895         return tag_ptr(ret_conv, true);
51896 }
51897
51898 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) {
51899         LDKPeerManager this_arg_conv;
51900         this_arg_conv.inner = untag_ptr(this_arg);
51901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51903         this_arg_conv.is_owned = false;
51904         void* descriptor_ptr = untag_ptr(descriptor);
51905         CHECK_ACCESS(descriptor_ptr);
51906         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
51907         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
51908                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51909                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
51910         }
51911         void* remote_network_address_ptr = untag_ptr(remote_network_address);
51912         CHECK_ACCESS(remote_network_address_ptr);
51913         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
51914         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
51915         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
51916         return tag_ptr(ret_conv, true);
51917 }
51918
51919 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) {
51920         LDKPeerManager this_arg_conv;
51921         this_arg_conv.inner = untag_ptr(this_arg);
51922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51924         this_arg_conv.is_owned = false;
51925         void* descriptor_ptr = untag_ptr(descriptor);
51926         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
51927         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
51928         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
51929         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
51930         return tag_ptr(ret_conv, true);
51931 }
51932
51933 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) {
51934         LDKPeerManager this_arg_conv;
51935         this_arg_conv.inner = untag_ptr(this_arg);
51936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51938         this_arg_conv.is_owned = false;
51939         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
51940         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
51941         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
51942         LDKu8slice data_ref;
51943         data_ref.datalen = (*env)->GetArrayLength(env, data);
51944         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
51945         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
51946         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
51947         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
51948         return tag_ptr(ret_conv, true);
51949 }
51950
51951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
51952         LDKPeerManager this_arg_conv;
51953         this_arg_conv.inner = untag_ptr(this_arg);
51954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51956         this_arg_conv.is_owned = false;
51957         PeerManager_process_events(&this_arg_conv);
51958 }
51959
51960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
51961         LDKPeerManager this_arg_conv;
51962         this_arg_conv.inner = untag_ptr(this_arg);
51963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51965         this_arg_conv.is_owned = false;
51966         void* descriptor_ptr = untag_ptr(descriptor);
51967         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
51968         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
51969         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
51970 }
51971
51972 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) {
51973         LDKPeerManager this_arg_conv;
51974         this_arg_conv.inner = untag_ptr(this_arg);
51975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51977         this_arg_conv.is_owned = false;
51978         LDKPublicKey node_id_ref;
51979         CHECK((*env)->GetArrayLength(env, node_id) == 33);
51980         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
51981         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
51982 }
51983
51984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
51985         LDKPeerManager this_arg_conv;
51986         this_arg_conv.inner = untag_ptr(this_arg);
51987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51989         this_arg_conv.is_owned = false;
51990         PeerManager_disconnect_all_peers(&this_arg_conv);
51991 }
51992
51993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
51994         LDKPeerManager this_arg_conv;
51995         this_arg_conv.inner = untag_ptr(this_arg);
51996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51998         this_arg_conv.is_owned = false;
51999         PeerManager_timer_tick_occurred(&this_arg_conv);
52000 }
52001
52002 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) {
52003         LDKPeerManager this_arg_conv;
52004         this_arg_conv.inner = untag_ptr(this_arg);
52005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52007         this_arg_conv.is_owned = false;
52008         LDKThreeBytes rgb_ref;
52009         CHECK((*env)->GetArrayLength(env, rgb) == 3);
52010         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
52011         LDKThirtyTwoBytes alias_ref;
52012         CHECK((*env)->GetArrayLength(env, alias) == 32);
52013         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
52014         LDKCVec_SocketAddressZ addresses_constr;
52015         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
52016         if (addresses_constr.datalen > 0)
52017                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52018         else
52019                 addresses_constr.data = NULL;
52020         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
52021         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52022                 int64_t addresses_conv_15 = addresses_vals[p];
52023                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52024                 CHECK_ACCESS(addresses_conv_15_ptr);
52025                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52026                 addresses_constr.data[p] = addresses_conv_15_conv;
52027         }
52028         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
52029         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52030 }
52031
52032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52033         LDKChannelTypeFeatures channel_type_features_conv;
52034         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52035         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52036         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52037         channel_type_features_conv.is_owned = false;
52038         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52039         return ret_conv;
52040 }
52041
52042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52043         LDKChannelTypeFeatures channel_type_features_conv;
52044         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52045         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52047         channel_type_features_conv.is_owned = false;
52048         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52049         return ret_conv;
52050 }
52051
52052 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52053         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52054         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
52055         return ret_conv;
52056 }
52057
52058 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
52059         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
52060         return ret_conv;
52061 }
52062
52063 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
52064         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
52065         return ret_conv;
52066 }
52067
52068 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
52069         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
52070         return ret_conv;
52071 }
52072
52073 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
52074         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
52075         return ret_conv;
52076 }
52077
52078 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
52079         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
52080         return ret_conv;
52081 }
52082
52083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52084         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52085         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52086         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52087         return ret_conv;
52088 }
52089
52090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
52091         LDKWitness witness_ref;
52092         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
52093         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52094         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
52095         witness_ref.data_is_owned = true;
52096         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52097         *ret_copy = HTLCClaim_from_witness(witness_ref);
52098         int64_t ret_ref = tag_ptr(ret_copy, true);
52099         return ret_ref;
52100 }
52101
52102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
52103         uint8_t commitment_seed_arr[32];
52104         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
52105         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
52106         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52107         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52108         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
52109         return ret_arr;
52110 }
52111
52112 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) {
52113         LDKCVec_u8Z to_holder_script_ref;
52114         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
52115         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52116         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
52117         LDKCVec_u8Z to_counterparty_script_ref;
52118         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
52119         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52120         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
52121         LDKOutPoint funding_outpoint_conv;
52122         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52123         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52124         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52125         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52126         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);
52127         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52128         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52129         Transaction_free(ret_var);
52130         return ret_arr;
52131 }
52132
52133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52134         LDKCounterpartyCommitmentSecrets this_obj_conv;
52135         this_obj_conv.inner = untag_ptr(this_obj);
52136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52138         CounterpartyCommitmentSecrets_free(this_obj_conv);
52139 }
52140
52141 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52142         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52143         int64_t ret_ref = 0;
52144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52146         return ret_ref;
52147 }
52148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52149         LDKCounterpartyCommitmentSecrets arg_conv;
52150         arg_conv.inner = untag_ptr(arg);
52151         arg_conv.is_owned = ptr_is_owned(arg);
52152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52153         arg_conv.is_owned = false;
52154         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52155         return ret_conv;
52156 }
52157
52158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52159         LDKCounterpartyCommitmentSecrets orig_conv;
52160         orig_conv.inner = untag_ptr(orig);
52161         orig_conv.is_owned = ptr_is_owned(orig);
52162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52163         orig_conv.is_owned = false;
52164         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52165         int64_t ret_ref = 0;
52166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52168         return ret_ref;
52169 }
52170
52171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
52172         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52173         int64_t ret_ref = 0;
52174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52176         return ret_ref;
52177 }
52178
52179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
52180         LDKCounterpartyCommitmentSecrets this_arg_conv;
52181         this_arg_conv.inner = untag_ptr(this_arg);
52182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52184         this_arg_conv.is_owned = false;
52185         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
52186         return ret_conv;
52187 }
52188
52189 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) {
52190         LDKCounterpartyCommitmentSecrets this_arg_conv;
52191         this_arg_conv.inner = untag_ptr(this_arg);
52192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52194         this_arg_conv.is_owned = false;
52195         LDKThirtyTwoBytes secret_ref;
52196         CHECK((*env)->GetArrayLength(env, secret) == 32);
52197         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
52198         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52199         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
52200         return tag_ptr(ret_conv, true);
52201 }
52202
52203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
52204         LDKCounterpartyCommitmentSecrets this_arg_conv;
52205         this_arg_conv.inner = untag_ptr(this_arg);
52206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52208         this_arg_conv.is_owned = false;
52209         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52210         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
52211         return ret_arr;
52212 }
52213
52214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
52215         LDKCounterpartyCommitmentSecrets obj_conv;
52216         obj_conv.inner = untag_ptr(obj);
52217         obj_conv.is_owned = ptr_is_owned(obj);
52218         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52219         obj_conv.is_owned = false;
52220         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
52221         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52222         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52223         CVec_u8Z_free(ret_var);
52224         return ret_arr;
52225 }
52226
52227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52228         LDKu8slice ser_ref;
52229         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52230         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52231         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
52232         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
52233         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52234         return tag_ptr(ret_conv, true);
52235 }
52236
52237 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) {
52238         LDKPublicKey per_commitment_point_ref;
52239         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52240         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52241         uint8_t base_secret_arr[32];
52242         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
52243         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
52244         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
52245         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52246         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
52247         return ret_arr;
52248 }
52249
52250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
52251         LDKPublicKey per_commitment_point_ref;
52252         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52253         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52254         LDKPublicKey base_point_ref;
52255         CHECK((*env)->GetArrayLength(env, base_point) == 33);
52256         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
52257         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52258         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
52259         return ret_arr;
52260 }
52261
52262 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) {
52263         uint8_t per_commitment_secret_arr[32];
52264         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
52265         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
52266         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
52267         uint8_t countersignatory_revocation_base_secret_arr[32];
52268         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
52269         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
52270         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
52271         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52272         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
52273         return ret_arr;
52274 }
52275
52276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
52277         LDKPublicKey per_commitment_point_ref;
52278         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52279         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52280         LDKPublicKey countersignatory_revocation_base_point_ref;
52281         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
52282         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
52283         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52284         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
52285         return ret_arr;
52286 }
52287
52288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52289         LDKTxCreationKeys this_obj_conv;
52290         this_obj_conv.inner = untag_ptr(this_obj);
52291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52293         TxCreationKeys_free(this_obj_conv);
52294 }
52295
52296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52297         LDKTxCreationKeys this_ptr_conv;
52298         this_ptr_conv.inner = untag_ptr(this_ptr);
52299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52301         this_ptr_conv.is_owned = false;
52302         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52303         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
52304         return ret_arr;
52305 }
52306
52307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52308         LDKTxCreationKeys this_ptr_conv;
52309         this_ptr_conv.inner = untag_ptr(this_ptr);
52310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52312         this_ptr_conv.is_owned = false;
52313         LDKPublicKey val_ref;
52314         CHECK((*env)->GetArrayLength(env, val) == 33);
52315         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52316         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
52317 }
52318
52319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52320         LDKTxCreationKeys this_ptr_conv;
52321         this_ptr_conv.inner = untag_ptr(this_ptr);
52322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52324         this_ptr_conv.is_owned = false;
52325         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52326         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
52327         return ret_arr;
52328 }
52329
52330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52331         LDKTxCreationKeys this_ptr_conv;
52332         this_ptr_conv.inner = untag_ptr(this_ptr);
52333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52335         this_ptr_conv.is_owned = false;
52336         LDKPublicKey val_ref;
52337         CHECK((*env)->GetArrayLength(env, val) == 33);
52338         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52339         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
52340 }
52341
52342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52343         LDKTxCreationKeys this_ptr_conv;
52344         this_ptr_conv.inner = untag_ptr(this_ptr);
52345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52347         this_ptr_conv.is_owned = false;
52348         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52349         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
52350         return ret_arr;
52351 }
52352
52353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52354         LDKTxCreationKeys this_ptr_conv;
52355         this_ptr_conv.inner = untag_ptr(this_ptr);
52356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52358         this_ptr_conv.is_owned = false;
52359         LDKPublicKey val_ref;
52360         CHECK((*env)->GetArrayLength(env, val) == 33);
52361         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52362         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
52363 }
52364
52365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52366         LDKTxCreationKeys this_ptr_conv;
52367         this_ptr_conv.inner = untag_ptr(this_ptr);
52368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52370         this_ptr_conv.is_owned = false;
52371         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52372         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
52373         return ret_arr;
52374 }
52375
52376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52377         LDKTxCreationKeys this_ptr_conv;
52378         this_ptr_conv.inner = untag_ptr(this_ptr);
52379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52381         this_ptr_conv.is_owned = false;
52382         LDKPublicKey val_ref;
52383         CHECK((*env)->GetArrayLength(env, val) == 33);
52384         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52385         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
52386 }
52387
52388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52389         LDKTxCreationKeys this_ptr_conv;
52390         this_ptr_conv.inner = untag_ptr(this_ptr);
52391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52393         this_ptr_conv.is_owned = false;
52394         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52395         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
52396         return ret_arr;
52397 }
52398
52399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52400         LDKTxCreationKeys this_ptr_conv;
52401         this_ptr_conv.inner = untag_ptr(this_ptr);
52402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52404         this_ptr_conv.is_owned = false;
52405         LDKPublicKey val_ref;
52406         CHECK((*env)->GetArrayLength(env, val) == 33);
52407         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52408         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
52409 }
52410
52411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
52412         LDKPublicKey per_commitment_point_arg_ref;
52413         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
52414         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
52415         LDKPublicKey revocation_key_arg_ref;
52416         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
52417         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
52418         LDKPublicKey broadcaster_htlc_key_arg_ref;
52419         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
52420         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
52421         LDKPublicKey countersignatory_htlc_key_arg_ref;
52422         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
52423         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
52424         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
52425         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
52426         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
52427         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
52428         int64_t ret_ref = 0;
52429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52431         return ret_ref;
52432 }
52433
52434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52435         LDKTxCreationKeys a_conv;
52436         a_conv.inner = untag_ptr(a);
52437         a_conv.is_owned = ptr_is_owned(a);
52438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52439         a_conv.is_owned = false;
52440         LDKTxCreationKeys b_conv;
52441         b_conv.inner = untag_ptr(b);
52442         b_conv.is_owned = ptr_is_owned(b);
52443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52444         b_conv.is_owned = false;
52445         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
52446         return ret_conv;
52447 }
52448
52449 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
52450         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
52451         int64_t ret_ref = 0;
52452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52454         return ret_ref;
52455 }
52456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52457         LDKTxCreationKeys arg_conv;
52458         arg_conv.inner = untag_ptr(arg);
52459         arg_conv.is_owned = ptr_is_owned(arg);
52460         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52461         arg_conv.is_owned = false;
52462         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
52463         return ret_conv;
52464 }
52465
52466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52467         LDKTxCreationKeys orig_conv;
52468         orig_conv.inner = untag_ptr(orig);
52469         orig_conv.is_owned = ptr_is_owned(orig);
52470         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52471         orig_conv.is_owned = false;
52472         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
52473         int64_t ret_ref = 0;
52474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52476         return ret_ref;
52477 }
52478
52479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
52480         LDKTxCreationKeys obj_conv;
52481         obj_conv.inner = untag_ptr(obj);
52482         obj_conv.is_owned = ptr_is_owned(obj);
52483         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52484         obj_conv.is_owned = false;
52485         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
52486         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52487         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52488         CVec_u8Z_free(ret_var);
52489         return ret_arr;
52490 }
52491
52492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52493         LDKu8slice ser_ref;
52494         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52495         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52496         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
52497         *ret_conv = TxCreationKeys_read(ser_ref);
52498         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52499         return tag_ptr(ret_conv, true);
52500 }
52501
52502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52503         LDKChannelPublicKeys this_obj_conv;
52504         this_obj_conv.inner = untag_ptr(this_obj);
52505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52507         ChannelPublicKeys_free(this_obj_conv);
52508 }
52509
52510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52511         LDKChannelPublicKeys this_ptr_conv;
52512         this_ptr_conv.inner = untag_ptr(this_ptr);
52513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52515         this_ptr_conv.is_owned = false;
52516         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52517         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
52518         return ret_arr;
52519 }
52520
52521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52522         LDKChannelPublicKeys this_ptr_conv;
52523         this_ptr_conv.inner = untag_ptr(this_ptr);
52524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52526         this_ptr_conv.is_owned = false;
52527         LDKPublicKey val_ref;
52528         CHECK((*env)->GetArrayLength(env, val) == 33);
52529         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52530         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
52531 }
52532
52533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52534         LDKChannelPublicKeys this_ptr_conv;
52535         this_ptr_conv.inner = untag_ptr(this_ptr);
52536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52538         this_ptr_conv.is_owned = false;
52539         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52540         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
52541         return ret_arr;
52542 }
52543
52544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52545         LDKChannelPublicKeys this_ptr_conv;
52546         this_ptr_conv.inner = untag_ptr(this_ptr);
52547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52549         this_ptr_conv.is_owned = false;
52550         LDKPublicKey val_ref;
52551         CHECK((*env)->GetArrayLength(env, val) == 33);
52552         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52553         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
52554 }
52555
52556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52557         LDKChannelPublicKeys 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52563         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
52564         return ret_arr;
52565 }
52566
52567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52568         LDKChannelPublicKeys this_ptr_conv;
52569         this_ptr_conv.inner = untag_ptr(this_ptr);
52570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52572         this_ptr_conv.is_owned = false;
52573         LDKPublicKey val_ref;
52574         CHECK((*env)->GetArrayLength(env, val) == 33);
52575         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52576         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
52577 }
52578
52579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52580         LDKChannelPublicKeys 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52586         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
52587         return ret_arr;
52588 }
52589
52590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52591         LDKChannelPublicKeys this_ptr_conv;
52592         this_ptr_conv.inner = untag_ptr(this_ptr);
52593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52595         this_ptr_conv.is_owned = false;
52596         LDKPublicKey val_ref;
52597         CHECK((*env)->GetArrayLength(env, val) == 33);
52598         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52599         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
52600 }
52601
52602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52603         LDKChannelPublicKeys 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52609         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
52610         return ret_arr;
52611 }
52612
52613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52614         LDKChannelPublicKeys this_ptr_conv;
52615         this_ptr_conv.inner = untag_ptr(this_ptr);
52616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52618         this_ptr_conv.is_owned = false;
52619         LDKPublicKey val_ref;
52620         CHECK((*env)->GetArrayLength(env, val) == 33);
52621         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52622         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
52623 }
52624
52625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, 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) {
52626         LDKPublicKey funding_pubkey_arg_ref;
52627         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
52628         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
52629         LDKPublicKey revocation_basepoint_arg_ref;
52630         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
52631         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
52632         LDKPublicKey payment_point_arg_ref;
52633         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
52634         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
52635         LDKPublicKey delayed_payment_basepoint_arg_ref;
52636         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
52637         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
52638         LDKPublicKey htlc_basepoint_arg_ref;
52639         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
52640         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
52641         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
52642         int64_t ret_ref = 0;
52643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52645         return ret_ref;
52646 }
52647
52648 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
52649         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
52650         int64_t ret_ref = 0;
52651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52653         return ret_ref;
52654 }
52655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52656         LDKChannelPublicKeys arg_conv;
52657         arg_conv.inner = untag_ptr(arg);
52658         arg_conv.is_owned = ptr_is_owned(arg);
52659         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52660         arg_conv.is_owned = false;
52661         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
52662         return ret_conv;
52663 }
52664
52665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52666         LDKChannelPublicKeys orig_conv;
52667         orig_conv.inner = untag_ptr(orig);
52668         orig_conv.is_owned = ptr_is_owned(orig);
52669         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52670         orig_conv.is_owned = false;
52671         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
52672         int64_t ret_ref = 0;
52673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52675         return ret_ref;
52676 }
52677
52678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
52679         LDKChannelPublicKeys o_conv;
52680         o_conv.inner = untag_ptr(o);
52681         o_conv.is_owned = ptr_is_owned(o);
52682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52683         o_conv.is_owned = false;
52684         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
52685         return ret_conv;
52686 }
52687
52688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52689         LDKChannelPublicKeys a_conv;
52690         a_conv.inner = untag_ptr(a);
52691         a_conv.is_owned = ptr_is_owned(a);
52692         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52693         a_conv.is_owned = false;
52694         LDKChannelPublicKeys b_conv;
52695         b_conv.inner = untag_ptr(b);
52696         b_conv.is_owned = ptr_is_owned(b);
52697         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52698         b_conv.is_owned = false;
52699         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
52700         return ret_conv;
52701 }
52702
52703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
52704         LDKChannelPublicKeys obj_conv;
52705         obj_conv.inner = untag_ptr(obj);
52706         obj_conv.is_owned = ptr_is_owned(obj);
52707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52708         obj_conv.is_owned = false;
52709         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
52710         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52711         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52712         CVec_u8Z_free(ret_var);
52713         return ret_arr;
52714 }
52715
52716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52717         LDKu8slice ser_ref;
52718         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52719         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52720         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
52721         *ret_conv = ChannelPublicKeys_read(ser_ref);
52722         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52723         return tag_ptr(ret_conv, true);
52724 }
52725
52726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
52727         LDKPublicKey per_commitment_point_ref;
52728         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52729         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52730         LDKPublicKey broadcaster_delayed_payment_base_ref;
52731         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
52732         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
52733         LDKPublicKey broadcaster_htlc_base_ref;
52734         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
52735         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
52736         LDKPublicKey countersignatory_revocation_base_ref;
52737         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
52738         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
52739         LDKPublicKey countersignatory_htlc_base_ref;
52740         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
52741         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
52742         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
52743         int64_t ret_ref = 0;
52744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52746         return ret_ref;
52747 }
52748
52749 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) {
52750         LDKPublicKey per_commitment_point_ref;
52751         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52752         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52753         LDKChannelPublicKeys broadcaster_keys_conv;
52754         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
52755         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
52756         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
52757         broadcaster_keys_conv.is_owned = false;
52758         LDKChannelPublicKeys countersignatory_keys_conv;
52759         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
52760         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
52761         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
52762         countersignatory_keys_conv.is_owned = false;
52763         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
52764         int64_t ret_ref = 0;
52765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52767         return ret_ref;
52768 }
52769
52770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
52771         LDKPublicKey revocation_key_ref;
52772         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
52773         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
52774         LDKPublicKey broadcaster_delayed_payment_key_ref;
52775         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
52776         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
52777         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
52778         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52779         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52780         CVec_u8Z_free(ret_var);
52781         return ret_arr;
52782 }
52783
52784 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) {
52785         LDKChannelTypeFeatures channel_type_features_conv;
52786         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52787         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52788         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52789         channel_type_features_conv.is_owned = false;
52790         LDKPublicKey payment_key_ref;
52791         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
52792         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
52793         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
52794         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52795         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52796         CVec_u8Z_free(ret_var);
52797         return ret_arr;
52798 }
52799
52800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52801         LDKHTLCOutputInCommitment this_obj_conv;
52802         this_obj_conv.inner = untag_ptr(this_obj);
52803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52805         HTLCOutputInCommitment_free(this_obj_conv);
52806 }
52807
52808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
52809         LDKHTLCOutputInCommitment this_ptr_conv;
52810         this_ptr_conv.inner = untag_ptr(this_ptr);
52811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52813         this_ptr_conv.is_owned = false;
52814         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
52815         return ret_conv;
52816 }
52817
52818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
52819         LDKHTLCOutputInCommitment this_ptr_conv;
52820         this_ptr_conv.inner = untag_ptr(this_ptr);
52821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52823         this_ptr_conv.is_owned = false;
52824         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
52825 }
52826
52827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52828         LDKHTLCOutputInCommitment this_ptr_conv;
52829         this_ptr_conv.inner = untag_ptr(this_ptr);
52830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52832         this_ptr_conv.is_owned = false;
52833         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
52834         return ret_conv;
52835 }
52836
52837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52838         LDKHTLCOutputInCommitment this_ptr_conv;
52839         this_ptr_conv.inner = untag_ptr(this_ptr);
52840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52842         this_ptr_conv.is_owned = false;
52843         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
52844 }
52845
52846 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
52847         LDKHTLCOutputInCommitment this_ptr_conv;
52848         this_ptr_conv.inner = untag_ptr(this_ptr);
52849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52851         this_ptr_conv.is_owned = false;
52852         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
52853         return ret_conv;
52854 }
52855
52856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52857         LDKHTLCOutputInCommitment this_ptr_conv;
52858         this_ptr_conv.inner = untag_ptr(this_ptr);
52859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52861         this_ptr_conv.is_owned = false;
52862         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
52863 }
52864
52865 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
52866         LDKHTLCOutputInCommitment this_ptr_conv;
52867         this_ptr_conv.inner = untag_ptr(this_ptr);
52868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52870         this_ptr_conv.is_owned = false;
52871         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52872         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
52873         return ret_arr;
52874 }
52875
52876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52877         LDKHTLCOutputInCommitment this_ptr_conv;
52878         this_ptr_conv.inner = untag_ptr(this_ptr);
52879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52881         this_ptr_conv.is_owned = false;
52882         LDKThirtyTwoBytes val_ref;
52883         CHECK((*env)->GetArrayLength(env, val) == 32);
52884         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52885         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
52886 }
52887
52888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
52889         LDKHTLCOutputInCommitment this_ptr_conv;
52890         this_ptr_conv.inner = untag_ptr(this_ptr);
52891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52893         this_ptr_conv.is_owned = false;
52894         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
52895         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
52896         int64_t ret_ref = tag_ptr(ret_copy, true);
52897         return ret_ref;
52898 }
52899
52900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52901         LDKHTLCOutputInCommitment this_ptr_conv;
52902         this_ptr_conv.inner = untag_ptr(this_ptr);
52903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52905         this_ptr_conv.is_owned = false;
52906         void* val_ptr = untag_ptr(val);
52907         CHECK_ACCESS(val_ptr);
52908         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
52909         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
52910         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
52911 }
52912
52913 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) {
52914         LDKThirtyTwoBytes payment_hash_arg_ref;
52915         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
52916         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
52917         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
52918         CHECK_ACCESS(transaction_output_index_arg_ptr);
52919         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
52920         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
52921         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
52922         int64_t ret_ref = 0;
52923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52925         return ret_ref;
52926 }
52927
52928 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
52929         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
52930         int64_t ret_ref = 0;
52931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52933         return ret_ref;
52934 }
52935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52936         LDKHTLCOutputInCommitment arg_conv;
52937         arg_conv.inner = untag_ptr(arg);
52938         arg_conv.is_owned = ptr_is_owned(arg);
52939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52940         arg_conv.is_owned = false;
52941         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
52942         return ret_conv;
52943 }
52944
52945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52946         LDKHTLCOutputInCommitment orig_conv;
52947         orig_conv.inner = untag_ptr(orig);
52948         orig_conv.is_owned = ptr_is_owned(orig);
52949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52950         orig_conv.is_owned = false;
52951         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
52952         int64_t ret_ref = 0;
52953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52955         return ret_ref;
52956 }
52957
52958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52959         LDKHTLCOutputInCommitment a_conv;
52960         a_conv.inner = untag_ptr(a);
52961         a_conv.is_owned = ptr_is_owned(a);
52962         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52963         a_conv.is_owned = false;
52964         LDKHTLCOutputInCommitment b_conv;
52965         b_conv.inner = untag_ptr(b);
52966         b_conv.is_owned = ptr_is_owned(b);
52967         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52968         b_conv.is_owned = false;
52969         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
52970         return ret_conv;
52971 }
52972
52973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
52974         LDKHTLCOutputInCommitment obj_conv;
52975         obj_conv.inner = untag_ptr(obj);
52976         obj_conv.is_owned = ptr_is_owned(obj);
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52978         obj_conv.is_owned = false;
52979         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
52980         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52981         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52982         CVec_u8Z_free(ret_var);
52983         return ret_arr;
52984 }
52985
52986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52987         LDKu8slice ser_ref;
52988         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52989         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52990         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
52991         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
52992         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52993         return tag_ptr(ret_conv, true);
52994 }
52995
52996 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) {
52997         LDKHTLCOutputInCommitment htlc_conv;
52998         htlc_conv.inner = untag_ptr(htlc);
52999         htlc_conv.is_owned = ptr_is_owned(htlc);
53000         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53001         htlc_conv.is_owned = false;
53002         LDKChannelTypeFeatures channel_type_features_conv;
53003         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53004         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53005         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53006         channel_type_features_conv.is_owned = false;
53007         LDKTxCreationKeys keys_conv;
53008         keys_conv.inner = untag_ptr(keys);
53009         keys_conv.is_owned = ptr_is_owned(keys);
53010         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53011         keys_conv.is_owned = false;
53012         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53013         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53014         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53015         CVec_u8Z_free(ret_var);
53016         return ret_arr;
53017 }
53018
53019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
53020         LDKPublicKey broadcaster_ref;
53021         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
53022         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
53023         LDKPublicKey countersignatory_ref;
53024         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
53025         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
53026         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53029         CVec_u8Z_free(ret_var);
53030         return ret_arr;
53031 }
53032
53033 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, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
53034         uint8_t commitment_txid_arr[32];
53035         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
53036         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
53037         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53038         LDKHTLCOutputInCommitment htlc_conv;
53039         htlc_conv.inner = untag_ptr(htlc);
53040         htlc_conv.is_owned = ptr_is_owned(htlc);
53041         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53042         htlc_conv.is_owned = false;
53043         LDKChannelTypeFeatures channel_type_features_conv;
53044         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53045         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53046         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53047         channel_type_features_conv.is_owned = false;
53048         LDKPublicKey broadcaster_delayed_payment_key_ref;
53049         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
53050         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
53051         LDKPublicKey revocation_key_ref;
53052         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
53053         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
53054         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
53055         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53056         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53057         Transaction_free(ret_var);
53058         return ret_arr;
53059 }
53060
53061 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) {
53062         LDKECDSASignature local_sig_ref;
53063         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
53064         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
53065         LDKECDSASignature remote_sig_ref;
53066         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
53067         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
53068         void* preimage_ptr = untag_ptr(preimage);
53069         CHECK_ACCESS(preimage_ptr);
53070         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53071         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53072         LDKu8slice redeem_script_ref;
53073         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
53074         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
53075         LDKChannelTypeFeatures channel_type_features_conv;
53076         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53077         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53078         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53079         channel_type_features_conv.is_owned = false;
53080         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53081         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53082         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53083         Witness_free(ret_var);
53084         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
53085         return ret_arr;
53086 }
53087
53088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
53089         LDKPublicKey payment_point_ref;
53090         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
53091         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
53092         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53093         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53094         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53095         CVec_u8Z_free(ret_var);
53096         return ret_arr;
53097 }
53098
53099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
53100         LDKPublicKey funding_pubkey_ref;
53101         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
53102         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
53103         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53104         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53105         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53106         CVec_u8Z_free(ret_var);
53107         return ret_arr;
53108 }
53109
53110 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) {
53111         LDKPublicKey funding_key_ref;
53112         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
53113         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
53114         LDKECDSASignature funding_sig_ref;
53115         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
53116         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
53117         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53118         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53119         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53120         Witness_free(ret_var);
53121         return ret_arr;
53122 }
53123
53124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53125         LDKChannelTransactionParameters this_obj_conv;
53126         this_obj_conv.inner = untag_ptr(this_obj);
53127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53129         ChannelTransactionParameters_free(this_obj_conv);
53130 }
53131
53132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
53133         LDKChannelTransactionParameters this_ptr_conv;
53134         this_ptr_conv.inner = untag_ptr(this_ptr);
53135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53137         this_ptr_conv.is_owned = false;
53138         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53139         int64_t ret_ref = 0;
53140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53142         return ret_ref;
53143 }
53144
53145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53146         LDKChannelTransactionParameters this_ptr_conv;
53147         this_ptr_conv.inner = untag_ptr(this_ptr);
53148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53150         this_ptr_conv.is_owned = false;
53151         LDKChannelPublicKeys val_conv;
53152         val_conv.inner = untag_ptr(val);
53153         val_conv.is_owned = ptr_is_owned(val);
53154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53155         val_conv = ChannelPublicKeys_clone(&val_conv);
53156         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
53157 }
53158
53159 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53160         LDKChannelTransactionParameters this_ptr_conv;
53161         this_ptr_conv.inner = untag_ptr(this_ptr);
53162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53164         this_ptr_conv.is_owned = false;
53165         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
53166         return ret_conv;
53167 }
53168
53169 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) {
53170         LDKChannelTransactionParameters this_ptr_conv;
53171         this_ptr_conv.inner = untag_ptr(this_ptr);
53172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53174         this_ptr_conv.is_owned = false;
53175         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
53176 }
53177
53178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
53179         LDKChannelTransactionParameters this_ptr_conv;
53180         this_ptr_conv.inner = untag_ptr(this_ptr);
53181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53183         this_ptr_conv.is_owned = false;
53184         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
53185         return ret_conv;
53186 }
53187
53188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
53189         LDKChannelTransactionParameters this_ptr_conv;
53190         this_ptr_conv.inner = untag_ptr(this_ptr);
53191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53193         this_ptr_conv.is_owned = false;
53194         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
53195 }
53196
53197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
53198         LDKChannelTransactionParameters this_ptr_conv;
53199         this_ptr_conv.inner = untag_ptr(this_ptr);
53200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53202         this_ptr_conv.is_owned = false;
53203         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
53204         int64_t ret_ref = 0;
53205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53207         return ret_ref;
53208 }
53209
53210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53211         LDKChannelTransactionParameters this_ptr_conv;
53212         this_ptr_conv.inner = untag_ptr(this_ptr);
53213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53215         this_ptr_conv.is_owned = false;
53216         LDKCounterpartyChannelTransactionParameters val_conv;
53217         val_conv.inner = untag_ptr(val);
53218         val_conv.is_owned = ptr_is_owned(val);
53219         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53220         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
53221         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
53222 }
53223
53224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53225         LDKChannelTransactionParameters this_ptr_conv;
53226         this_ptr_conv.inner = untag_ptr(this_ptr);
53227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53229         this_ptr_conv.is_owned = false;
53230         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
53231         int64_t ret_ref = 0;
53232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53234         return ret_ref;
53235 }
53236
53237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53238         LDKChannelTransactionParameters this_ptr_conv;
53239         this_ptr_conv.inner = untag_ptr(this_ptr);
53240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53242         this_ptr_conv.is_owned = false;
53243         LDKOutPoint val_conv;
53244         val_conv.inner = untag_ptr(val);
53245         val_conv.is_owned = ptr_is_owned(val);
53246         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53247         val_conv = OutPoint_clone(&val_conv);
53248         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
53249 }
53250
53251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53252         LDKChannelTransactionParameters this_ptr_conv;
53253         this_ptr_conv.inner = untag_ptr(this_ptr);
53254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53256         this_ptr_conv.is_owned = false;
53257         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
53258         int64_t ret_ref = 0;
53259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53261         return ret_ref;
53262 }
53263
53264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53265         LDKChannelTransactionParameters this_ptr_conv;
53266         this_ptr_conv.inner = untag_ptr(this_ptr);
53267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53269         this_ptr_conv.is_owned = false;
53270         LDKChannelTypeFeatures val_conv;
53271         val_conv.inner = untag_ptr(val);
53272         val_conv.is_owned = ptr_is_owned(val);
53273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53274         val_conv = ChannelTypeFeatures_clone(&val_conv);
53275         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
53276 }
53277
53278 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) {
53279         LDKChannelPublicKeys holder_pubkeys_arg_conv;
53280         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
53281         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
53282         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
53283         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
53284         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
53285         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
53286         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
53287         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
53288         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
53289         LDKOutPoint funding_outpoint_arg_conv;
53290         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
53291         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
53292         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
53293         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
53294         LDKChannelTypeFeatures channel_type_features_arg_conv;
53295         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
53296         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
53297         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
53298         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
53299         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);
53300         int64_t ret_ref = 0;
53301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53303         return ret_ref;
53304 }
53305
53306 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
53307         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
53308         int64_t ret_ref = 0;
53309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53311         return ret_ref;
53312 }
53313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53314         LDKChannelTransactionParameters arg_conv;
53315         arg_conv.inner = untag_ptr(arg);
53316         arg_conv.is_owned = ptr_is_owned(arg);
53317         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53318         arg_conv.is_owned = false;
53319         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
53320         return ret_conv;
53321 }
53322
53323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53324         LDKChannelTransactionParameters orig_conv;
53325         orig_conv.inner = untag_ptr(orig);
53326         orig_conv.is_owned = ptr_is_owned(orig);
53327         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53328         orig_conv.is_owned = false;
53329         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
53330         int64_t ret_ref = 0;
53331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53333         return ret_ref;
53334 }
53335
53336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
53337         LDKChannelTransactionParameters o_conv;
53338         o_conv.inner = untag_ptr(o);
53339         o_conv.is_owned = ptr_is_owned(o);
53340         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53341         o_conv.is_owned = false;
53342         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
53343         return ret_conv;
53344 }
53345
53346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53347         LDKChannelTransactionParameters a_conv;
53348         a_conv.inner = untag_ptr(a);
53349         a_conv.is_owned = ptr_is_owned(a);
53350         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53351         a_conv.is_owned = false;
53352         LDKChannelTransactionParameters b_conv;
53353         b_conv.inner = untag_ptr(b);
53354         b_conv.is_owned = ptr_is_owned(b);
53355         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53356         b_conv.is_owned = false;
53357         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
53358         return ret_conv;
53359 }
53360
53361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53362         LDKCounterpartyChannelTransactionParameters this_obj_conv;
53363         this_obj_conv.inner = untag_ptr(this_obj);
53364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53366         CounterpartyChannelTransactionParameters_free(this_obj_conv);
53367 }
53368
53369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
53370         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53371         this_ptr_conv.inner = untag_ptr(this_ptr);
53372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53374         this_ptr_conv.is_owned = false;
53375         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
53376         int64_t ret_ref = 0;
53377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53379         return ret_ref;
53380 }
53381
53382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53383         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53384         this_ptr_conv.inner = untag_ptr(this_ptr);
53385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53387         this_ptr_conv.is_owned = false;
53388         LDKChannelPublicKeys val_conv;
53389         val_conv.inner = untag_ptr(val);
53390         val_conv.is_owned = ptr_is_owned(val);
53391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53392         val_conv = ChannelPublicKeys_clone(&val_conv);
53393         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
53394 }
53395
53396 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53397         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53398         this_ptr_conv.inner = untag_ptr(this_ptr);
53399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53401         this_ptr_conv.is_owned = false;
53402         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
53403         return ret_conv;
53404 }
53405
53406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
53407         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53408         this_ptr_conv.inner = untag_ptr(this_ptr);
53409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53411         this_ptr_conv.is_owned = false;
53412         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
53413 }
53414
53415 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) {
53416         LDKChannelPublicKeys pubkeys_arg_conv;
53417         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
53418         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
53419         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
53420         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
53421         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
53422         int64_t ret_ref = 0;
53423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53425         return ret_ref;
53426 }
53427
53428 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
53429         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
53430         int64_t ret_ref = 0;
53431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53433         return ret_ref;
53434 }
53435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53436         LDKCounterpartyChannelTransactionParameters arg_conv;
53437         arg_conv.inner = untag_ptr(arg);
53438         arg_conv.is_owned = ptr_is_owned(arg);
53439         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53440         arg_conv.is_owned = false;
53441         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
53442         return ret_conv;
53443 }
53444
53445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53446         LDKCounterpartyChannelTransactionParameters orig_conv;
53447         orig_conv.inner = untag_ptr(orig);
53448         orig_conv.is_owned = ptr_is_owned(orig);
53449         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53450         orig_conv.is_owned = false;
53451         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
53452         int64_t ret_ref = 0;
53453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53455         return ret_ref;
53456 }
53457
53458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
53459         LDKCounterpartyChannelTransactionParameters o_conv;
53460         o_conv.inner = untag_ptr(o);
53461         o_conv.is_owned = ptr_is_owned(o);
53462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53463         o_conv.is_owned = false;
53464         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
53465         return ret_conv;
53466 }
53467
53468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53469         LDKCounterpartyChannelTransactionParameters a_conv;
53470         a_conv.inner = untag_ptr(a);
53471         a_conv.is_owned = ptr_is_owned(a);
53472         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53473         a_conv.is_owned = false;
53474         LDKCounterpartyChannelTransactionParameters b_conv;
53475         b_conv.inner = untag_ptr(b);
53476         b_conv.is_owned = ptr_is_owned(b);
53477         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53478         b_conv.is_owned = false;
53479         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
53480         return ret_conv;
53481 }
53482
53483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
53484         LDKChannelTransactionParameters this_arg_conv;
53485         this_arg_conv.inner = untag_ptr(this_arg);
53486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53488         this_arg_conv.is_owned = false;
53489         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
53490         return ret_conv;
53491 }
53492
53493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
53494         LDKChannelTransactionParameters this_arg_conv;
53495         this_arg_conv.inner = untag_ptr(this_arg);
53496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53498         this_arg_conv.is_owned = false;
53499         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
53500         int64_t ret_ref = 0;
53501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53503         return ret_ref;
53504 }
53505
53506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
53507         LDKChannelTransactionParameters this_arg_conv;
53508         this_arg_conv.inner = untag_ptr(this_arg);
53509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53511         this_arg_conv.is_owned = false;
53512         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
53513         int64_t ret_ref = 0;
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53516         return ret_ref;
53517 }
53518
53519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
53520         LDKCounterpartyChannelTransactionParameters obj_conv;
53521         obj_conv.inner = untag_ptr(obj);
53522         obj_conv.is_owned = ptr_is_owned(obj);
53523         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53524         obj_conv.is_owned = false;
53525         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
53526         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53527         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53528         CVec_u8Z_free(ret_var);
53529         return ret_arr;
53530 }
53531
53532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53533         LDKu8slice ser_ref;
53534         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53535         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53536         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
53537         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
53538         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53539         return tag_ptr(ret_conv, true);
53540 }
53541
53542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
53543         LDKChannelTransactionParameters obj_conv;
53544         obj_conv.inner = untag_ptr(obj);
53545         obj_conv.is_owned = ptr_is_owned(obj);
53546         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53547         obj_conv.is_owned = false;
53548         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
53549         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53550         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53551         CVec_u8Z_free(ret_var);
53552         return ret_arr;
53553 }
53554
53555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53556         LDKu8slice ser_ref;
53557         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53558         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53559         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
53560         *ret_conv = ChannelTransactionParameters_read(ser_ref);
53561         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53562         return tag_ptr(ret_conv, true);
53563 }
53564
53565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53566         LDKDirectedChannelTransactionParameters this_obj_conv;
53567         this_obj_conv.inner = untag_ptr(this_obj);
53568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53570         DirectedChannelTransactionParameters_free(this_obj_conv);
53571 }
53572
53573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
53574         LDKDirectedChannelTransactionParameters this_arg_conv;
53575         this_arg_conv.inner = untag_ptr(this_arg);
53576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53578         this_arg_conv.is_owned = false;
53579         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
53580         int64_t ret_ref = 0;
53581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53583         return ret_ref;
53584 }
53585
53586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
53587         LDKDirectedChannelTransactionParameters this_arg_conv;
53588         this_arg_conv.inner = untag_ptr(this_arg);
53589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53591         this_arg_conv.is_owned = false;
53592         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
53593         int64_t ret_ref = 0;
53594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53596         return ret_ref;
53597 }
53598
53599 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
53600         LDKDirectedChannelTransactionParameters this_arg_conv;
53601         this_arg_conv.inner = untag_ptr(this_arg);
53602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53604         this_arg_conv.is_owned = false;
53605         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
53606         return ret_conv;
53607 }
53608
53609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
53610         LDKDirectedChannelTransactionParameters this_arg_conv;
53611         this_arg_conv.inner = untag_ptr(this_arg);
53612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53614         this_arg_conv.is_owned = false;
53615         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
53616         return ret_conv;
53617 }
53618
53619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
53620         LDKDirectedChannelTransactionParameters this_arg_conv;
53621         this_arg_conv.inner = untag_ptr(this_arg);
53622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53624         this_arg_conv.is_owned = false;
53625         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
53626         int64_t ret_ref = 0;
53627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53629         return ret_ref;
53630 }
53631
53632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
53633         LDKDirectedChannelTransactionParameters this_arg_conv;
53634         this_arg_conv.inner = untag_ptr(this_arg);
53635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53637         this_arg_conv.is_owned = false;
53638         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
53639         int64_t ret_ref = 0;
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53642         return ret_ref;
53643 }
53644
53645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53646         LDKHolderCommitmentTransaction this_obj_conv;
53647         this_obj_conv.inner = untag_ptr(this_obj);
53648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53650         HolderCommitmentTransaction_free(this_obj_conv);
53651 }
53652
53653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
53654         LDKHolderCommitmentTransaction this_ptr_conv;
53655         this_ptr_conv.inner = untag_ptr(this_ptr);
53656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53658         this_ptr_conv.is_owned = false;
53659         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53660         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
53661         return ret_arr;
53662 }
53663
53664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53665         LDKHolderCommitmentTransaction this_ptr_conv;
53666         this_ptr_conv.inner = untag_ptr(this_ptr);
53667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53669         this_ptr_conv.is_owned = false;
53670         LDKECDSASignature val_ref;
53671         CHECK((*env)->GetArrayLength(env, val) == 64);
53672         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53673         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
53674 }
53675
53676 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
53677         LDKHolderCommitmentTransaction this_ptr_conv;
53678         this_ptr_conv.inner = untag_ptr(this_ptr);
53679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53681         this_ptr_conv.is_owned = false;
53682         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
53683         jobjectArray ret_arr = NULL;
53684         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
53685         ;
53686         for (size_t i = 0; i < ret_var.datalen; i++) {
53687                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
53688                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
53689                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
53690         }
53691         
53692         FREE(ret_var.data);
53693         return ret_arr;
53694 }
53695
53696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
53697         LDKHolderCommitmentTransaction this_ptr_conv;
53698         this_ptr_conv.inner = untag_ptr(this_ptr);
53699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53701         this_ptr_conv.is_owned = false;
53702         LDKCVec_ECDSASignatureZ val_constr;
53703         val_constr.datalen = (*env)->GetArrayLength(env, val);
53704         if (val_constr.datalen > 0)
53705                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
53706         else
53707                 val_constr.data = NULL;
53708         for (size_t i = 0; i < val_constr.datalen; i++) {
53709                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
53710                 LDKECDSASignature val_conv_8_ref;
53711                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
53712                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
53713                 val_constr.data[i] = val_conv_8_ref;
53714         }
53715         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
53716 }
53717
53718 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
53719         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
53720         int64_t ret_ref = 0;
53721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53723         return ret_ref;
53724 }
53725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53726         LDKHolderCommitmentTransaction arg_conv;
53727         arg_conv.inner = untag_ptr(arg);
53728         arg_conv.is_owned = ptr_is_owned(arg);
53729         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53730         arg_conv.is_owned = false;
53731         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
53732         return ret_conv;
53733 }
53734
53735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53736         LDKHolderCommitmentTransaction orig_conv;
53737         orig_conv.inner = untag_ptr(orig);
53738         orig_conv.is_owned = ptr_is_owned(orig);
53739         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53740         orig_conv.is_owned = false;
53741         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
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
53748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
53749         LDKHolderCommitmentTransaction obj_conv;
53750         obj_conv.inner = untag_ptr(obj);
53751         obj_conv.is_owned = ptr_is_owned(obj);
53752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53753         obj_conv.is_owned = false;
53754         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
53755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53757         CVec_u8Z_free(ret_var);
53758         return ret_arr;
53759 }
53760
53761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53762         LDKu8slice ser_ref;
53763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53765         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
53766         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
53767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53768         return tag_ptr(ret_conv, true);
53769 }
53770
53771 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) {
53772         LDKCommitmentTransaction commitment_tx_conv;
53773         commitment_tx_conv.inner = untag_ptr(commitment_tx);
53774         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
53775         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
53776         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
53777         LDKECDSASignature counterparty_sig_ref;
53778         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
53779         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
53780         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
53781         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
53782         if (counterparty_htlc_sigs_constr.datalen > 0)
53783                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
53784         else
53785                 counterparty_htlc_sigs_constr.data = NULL;
53786         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
53787                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
53788                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
53789                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
53790                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
53791                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
53792         }
53793         LDKPublicKey holder_funding_key_ref;
53794         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
53795         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
53796         LDKPublicKey counterparty_funding_key_ref;
53797         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
53798         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
53799         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
53800         int64_t ret_ref = 0;
53801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53803         return ret_ref;
53804 }
53805
53806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53807         LDKBuiltCommitmentTransaction this_obj_conv;
53808         this_obj_conv.inner = untag_ptr(this_obj);
53809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53811         BuiltCommitmentTransaction_free(this_obj_conv);
53812 }
53813
53814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
53815         LDKBuiltCommitmentTransaction this_ptr_conv;
53816         this_ptr_conv.inner = untag_ptr(this_ptr);
53817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53819         this_ptr_conv.is_owned = false;
53820         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
53821         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53822         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53823         Transaction_free(ret_var);
53824         return ret_arr;
53825 }
53826
53827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53828         LDKBuiltCommitmentTransaction this_ptr_conv;
53829         this_ptr_conv.inner = untag_ptr(this_ptr);
53830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53832         this_ptr_conv.is_owned = false;
53833         LDKTransaction val_ref;
53834         val_ref.datalen = (*env)->GetArrayLength(env, val);
53835         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
53836         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
53837         val_ref.data_is_owned = true;
53838         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
53839 }
53840
53841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
53842         LDKBuiltCommitmentTransaction 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53848         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
53849         return ret_arr;
53850 }
53851
53852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53853         LDKBuiltCommitmentTransaction this_ptr_conv;
53854         this_ptr_conv.inner = untag_ptr(this_ptr);
53855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53857         this_ptr_conv.is_owned = false;
53858         LDKThirtyTwoBytes val_ref;
53859         CHECK((*env)->GetArrayLength(env, val) == 32);
53860         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53861         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
53862 }
53863
53864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
53865         LDKTransaction transaction_arg_ref;
53866         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
53867         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
53868         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
53869         transaction_arg_ref.data_is_owned = true;
53870         LDKThirtyTwoBytes txid_arg_ref;
53871         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
53872         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
53873         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
53874         int64_t ret_ref = 0;
53875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53877         return ret_ref;
53878 }
53879
53880 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
53881         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
53882         int64_t ret_ref = 0;
53883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53885         return ret_ref;
53886 }
53887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53888         LDKBuiltCommitmentTransaction arg_conv;
53889         arg_conv.inner = untag_ptr(arg);
53890         arg_conv.is_owned = ptr_is_owned(arg);
53891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53892         arg_conv.is_owned = false;
53893         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
53894         return ret_conv;
53895 }
53896
53897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53898         LDKBuiltCommitmentTransaction orig_conv;
53899         orig_conv.inner = untag_ptr(orig);
53900         orig_conv.is_owned = ptr_is_owned(orig);
53901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53902         orig_conv.is_owned = false;
53903         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
53904         int64_t ret_ref = 0;
53905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53907         return ret_ref;
53908 }
53909
53910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
53911         LDKBuiltCommitmentTransaction obj_conv;
53912         obj_conv.inner = untag_ptr(obj);
53913         obj_conv.is_owned = ptr_is_owned(obj);
53914         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53915         obj_conv.is_owned = false;
53916         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
53917         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53918         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53919         CVec_u8Z_free(ret_var);
53920         return ret_arr;
53921 }
53922
53923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53924         LDKu8slice ser_ref;
53925         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53926         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53927         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
53928         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
53929         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53930         return tag_ptr(ret_conv, true);
53931 }
53932
53933 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) {
53934         LDKBuiltCommitmentTransaction this_arg_conv;
53935         this_arg_conv.inner = untag_ptr(this_arg);
53936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53938         this_arg_conv.is_owned = false;
53939         LDKu8slice funding_redeemscript_ref;
53940         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
53941         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
53942         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53943         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
53944         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
53945         return ret_arr;
53946 }
53947
53948 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) {
53949         LDKBuiltCommitmentTransaction this_arg_conv;
53950         this_arg_conv.inner = untag_ptr(this_arg);
53951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53953         this_arg_conv.is_owned = false;
53954         uint8_t funding_key_arr[32];
53955         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
53956         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
53957         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
53958         LDKu8slice funding_redeemscript_ref;
53959         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
53960         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
53961         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53962         (*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);
53963         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
53964         return ret_arr;
53965 }
53966
53967 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) {
53968         LDKBuiltCommitmentTransaction this_arg_conv;
53969         this_arg_conv.inner = untag_ptr(this_arg);
53970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53972         this_arg_conv.is_owned = false;
53973         uint8_t funding_key_arr[32];
53974         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
53975         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
53976         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
53977         LDKu8slice funding_redeemscript_ref;
53978         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
53979         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
53980         void* entropy_source_ptr = untag_ptr(entropy_source);
53981         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
53982         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
53983         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53984         (*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);
53985         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
53986         return ret_arr;
53987 }
53988
53989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53990         LDKClosingTransaction this_obj_conv;
53991         this_obj_conv.inner = untag_ptr(this_obj);
53992         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53994         ClosingTransaction_free(this_obj_conv);
53995 }
53996
53997 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
53998         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
53999         int64_t ret_ref = 0;
54000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54002         return ret_ref;
54003 }
54004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54005         LDKClosingTransaction arg_conv;
54006         arg_conv.inner = untag_ptr(arg);
54007         arg_conv.is_owned = ptr_is_owned(arg);
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54009         arg_conv.is_owned = false;
54010         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54011         return ret_conv;
54012 }
54013
54014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54015         LDKClosingTransaction orig_conv;
54016         orig_conv.inner = untag_ptr(orig);
54017         orig_conv.is_owned = ptr_is_owned(orig);
54018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54019         orig_conv.is_owned = false;
54020         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54021         int64_t ret_ref = 0;
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54024         return ret_ref;
54025 }
54026
54027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
54028         LDKClosingTransaction o_conv;
54029         o_conv.inner = untag_ptr(o);
54030         o_conv.is_owned = ptr_is_owned(o);
54031         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54032         o_conv.is_owned = false;
54033         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54034         return ret_conv;
54035 }
54036
54037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54038         LDKClosingTransaction a_conv;
54039         a_conv.inner = untag_ptr(a);
54040         a_conv.is_owned = ptr_is_owned(a);
54041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54042         a_conv.is_owned = false;
54043         LDKClosingTransaction b_conv;
54044         b_conv.inner = untag_ptr(b);
54045         b_conv.is_owned = ptr_is_owned(b);
54046         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54047         b_conv.is_owned = false;
54048         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54049         return ret_conv;
54050 }
54051
54052 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) {
54053         LDKCVec_u8Z to_holder_script_ref;
54054         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
54055         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54056         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
54057         LDKCVec_u8Z to_counterparty_script_ref;
54058         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
54059         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54060         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
54061         LDKOutPoint funding_outpoint_conv;
54062         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54063         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54064         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54065         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54066         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54067         int64_t ret_ref = 0;
54068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54070         return ret_ref;
54071 }
54072
54073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54074         LDKClosingTransaction this_arg_conv;
54075         this_arg_conv.inner = untag_ptr(this_arg);
54076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54078         this_arg_conv.is_owned = false;
54079         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54080         int64_t ret_ref = 0;
54081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54083         return ret_ref;
54084 }
54085
54086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
54087         LDKClosingTransaction this_arg_conv;
54088         this_arg_conv.inner = untag_ptr(this_arg);
54089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54091         this_arg_conv.is_owned = false;
54092         LDKOutPoint funding_outpoint_conv;
54093         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54094         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54095         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54096         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54097         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54098         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54099         return tag_ptr(ret_conv, true);
54100 }
54101
54102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54103         LDKClosingTransaction this_arg_conv;
54104         this_arg_conv.inner = untag_ptr(this_arg);
54105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54107         this_arg_conv.is_owned = false;
54108         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54109         return ret_conv;
54110 }
54111
54112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54113         LDKClosingTransaction this_arg_conv;
54114         this_arg_conv.inner = untag_ptr(this_arg);
54115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54117         this_arg_conv.is_owned = false;
54118         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54119         return ret_conv;
54120 }
54121
54122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54123         LDKClosingTransaction this_arg_conv;
54124         this_arg_conv.inner = untag_ptr(this_arg);
54125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54127         this_arg_conv.is_owned = false;
54128         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54129         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54130         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54131         return ret_arr;
54132 }
54133
54134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54135         LDKClosingTransaction this_arg_conv;
54136         this_arg_conv.inner = untag_ptr(this_arg);
54137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54139         this_arg_conv.is_owned = false;
54140         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54141         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54142         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54143         return ret_arr;
54144 }
54145
54146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54147         LDKTrustedClosingTransaction this_obj_conv;
54148         this_obj_conv.inner = untag_ptr(this_obj);
54149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54151         TrustedClosingTransaction_free(this_obj_conv);
54152 }
54153
54154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
54155         LDKTrustedClosingTransaction this_arg_conv;
54156         this_arg_conv.inner = untag_ptr(this_arg);
54157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54159         this_arg_conv.is_owned = false;
54160         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
54161         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54162         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54163         Transaction_free(ret_var);
54164         return ret_arr;
54165 }
54166
54167 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) {
54168         LDKTrustedClosingTransaction this_arg_conv;
54169         this_arg_conv.inner = untag_ptr(this_arg);
54170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54172         this_arg_conv.is_owned = false;
54173         LDKu8slice funding_redeemscript_ref;
54174         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54175         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54176         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54177         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
54178         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54179         return ret_arr;
54180 }
54181
54182 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) {
54183         LDKTrustedClosingTransaction this_arg_conv;
54184         this_arg_conv.inner = untag_ptr(this_arg);
54185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54187         this_arg_conv.is_owned = false;
54188         uint8_t funding_key_arr[32];
54189         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54190         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54191         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54192         LDKu8slice funding_redeemscript_ref;
54193         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54194         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54195         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54196         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
54197         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54198         return ret_arr;
54199 }
54200
54201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54202         LDKCommitmentTransaction this_obj_conv;
54203         this_obj_conv.inner = untag_ptr(this_obj);
54204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54206         CommitmentTransaction_free(this_obj_conv);
54207 }
54208
54209 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
54210         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
54211         int64_t ret_ref = 0;
54212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54214         return ret_ref;
54215 }
54216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54217         LDKCommitmentTransaction arg_conv;
54218         arg_conv.inner = untag_ptr(arg);
54219         arg_conv.is_owned = ptr_is_owned(arg);
54220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54221         arg_conv.is_owned = false;
54222         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
54223         return ret_conv;
54224 }
54225
54226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54227         LDKCommitmentTransaction orig_conv;
54228         orig_conv.inner = untag_ptr(orig);
54229         orig_conv.is_owned = ptr_is_owned(orig);
54230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54231         orig_conv.is_owned = false;
54232         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
54233         int64_t ret_ref = 0;
54234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54236         return ret_ref;
54237 }
54238
54239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54240         LDKCommitmentTransaction obj_conv;
54241         obj_conv.inner = untag_ptr(obj);
54242         obj_conv.is_owned = ptr_is_owned(obj);
54243         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54244         obj_conv.is_owned = false;
54245         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
54246         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54247         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54248         CVec_u8Z_free(ret_var);
54249         return ret_arr;
54250 }
54251
54252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54253         LDKu8slice ser_ref;
54254         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54255         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54256         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
54257         *ret_conv = CommitmentTransaction_read(ser_ref);
54258         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54259         return tag_ptr(ret_conv, true);
54260 }
54261
54262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
54263         LDKCommitmentTransaction this_arg_conv;
54264         this_arg_conv.inner = untag_ptr(this_arg);
54265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54267         this_arg_conv.is_owned = false;
54268         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
54269         return ret_conv;
54270 }
54271
54272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54273         LDKCommitmentTransaction this_arg_conv;
54274         this_arg_conv.inner = untag_ptr(this_arg);
54275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54277         this_arg_conv.is_owned = false;
54278         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
54279         return ret_conv;
54280 }
54281
54282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54283         LDKCommitmentTransaction this_arg_conv;
54284         this_arg_conv.inner = untag_ptr(this_arg);
54285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54287         this_arg_conv.is_owned = false;
54288         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
54289         return ret_conv;
54290 }
54291
54292 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
54293         LDKCommitmentTransaction this_arg_conv;
54294         this_arg_conv.inner = untag_ptr(this_arg);
54295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54297         this_arg_conv.is_owned = false;
54298         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
54299         return ret_conv;
54300 }
54301
54302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54303         LDKCommitmentTransaction this_arg_conv;
54304         this_arg_conv.inner = untag_ptr(this_arg);
54305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54307         this_arg_conv.is_owned = false;
54308         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
54309         int64_t ret_ref = 0;
54310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54312         return ret_ref;
54313 }
54314
54315 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) {
54316         LDKCommitmentTransaction this_arg_conv;
54317         this_arg_conv.inner = untag_ptr(this_arg);
54318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54320         this_arg_conv.is_owned = false;
54321         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54322         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54323         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54324         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54325         channel_parameters_conv.is_owned = false;
54326         LDKChannelPublicKeys broadcaster_keys_conv;
54327         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
54328         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
54329         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
54330         broadcaster_keys_conv.is_owned = false;
54331         LDKChannelPublicKeys countersignatory_keys_conv;
54332         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
54333         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
54334         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
54335         countersignatory_keys_conv.is_owned = false;
54336         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
54337         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
54338         return tag_ptr(ret_conv, true);
54339 }
54340
54341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54342         LDKTrustedCommitmentTransaction this_obj_conv;
54343         this_obj_conv.inner = untag_ptr(this_obj);
54344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54346         TrustedCommitmentTransaction_free(this_obj_conv);
54347 }
54348
54349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
54350         LDKTrustedCommitmentTransaction this_arg_conv;
54351         this_arg_conv.inner = untag_ptr(this_arg);
54352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54354         this_arg_conv.is_owned = false;
54355         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54356         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
54357         return ret_arr;
54358 }
54359
54360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
54361         LDKTrustedCommitmentTransaction this_arg_conv;
54362         this_arg_conv.inner = untag_ptr(this_arg);
54363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54365         this_arg_conv.is_owned = false;
54366         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
54367         int64_t ret_ref = 0;
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54370         return ret_ref;
54371 }
54372
54373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
54374         LDKTrustedCommitmentTransaction this_arg_conv;
54375         this_arg_conv.inner = untag_ptr(this_arg);
54376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54378         this_arg_conv.is_owned = false;
54379         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
54380         int64_t ret_ref = 0;
54381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54383         return ret_ref;
54384 }
54385
54386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
54387         LDKTrustedCommitmentTransaction this_arg_conv;
54388         this_arg_conv.inner = untag_ptr(this_arg);
54389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54391         this_arg_conv.is_owned = false;
54392         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
54393         int64_t ret_ref = 0;
54394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54396         return ret_ref;
54397 }
54398
54399 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) {
54400         LDKTrustedCommitmentTransaction this_arg_conv;
54401         this_arg_conv.inner = untag_ptr(this_arg);
54402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54404         this_arg_conv.is_owned = false;
54405         uint8_t htlc_base_key_arr[32];
54406         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
54407         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
54408         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
54409         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54410         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54411         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54412         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54413         channel_parameters_conv.is_owned = false;
54414         void* entropy_source_ptr = untag_ptr(entropy_source);
54415         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54416         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54417         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
54418         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
54419         return tag_ptr(ret_conv, true);
54420 }
54421
54422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
54423         LDKTrustedCommitmentTransaction this_arg_conv;
54424         this_arg_conv.inner = untag_ptr(this_arg);
54425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54427         this_arg_conv.is_owned = false;
54428         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
54429         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
54430         int64_t ret_ref = tag_ptr(ret_copy, true);
54431         return ret_ref;
54432 }
54433
54434 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) {
54435         LDKTrustedCommitmentTransaction this_arg_conv;
54436         this_arg_conv.inner = untag_ptr(this_arg);
54437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54439         this_arg_conv.is_owned = false;
54440         LDKCVec_u8Z destination_script_ref;
54441         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
54442         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
54443         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
54444         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
54445         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
54446         return tag_ptr(ret_conv, true);
54447 }
54448
54449 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) {
54450         LDKPublicKey broadcaster_payment_basepoint_ref;
54451         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
54452         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
54453         LDKPublicKey countersignatory_payment_basepoint_ref;
54454         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
54455         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
54456         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
54457         return ret_conv;
54458 }
54459
54460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54461         LDKInitFeatures a_conv;
54462         a_conv.inner = untag_ptr(a);
54463         a_conv.is_owned = ptr_is_owned(a);
54464         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54465         a_conv.is_owned = false;
54466         LDKInitFeatures b_conv;
54467         b_conv.inner = untag_ptr(b);
54468         b_conv.is_owned = ptr_is_owned(b);
54469         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54470         b_conv.is_owned = false;
54471         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
54472         return ret_conv;
54473 }
54474
54475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54476         LDKNodeFeatures a_conv;
54477         a_conv.inner = untag_ptr(a);
54478         a_conv.is_owned = ptr_is_owned(a);
54479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54480         a_conv.is_owned = false;
54481         LDKNodeFeatures b_conv;
54482         b_conv.inner = untag_ptr(b);
54483         b_conv.is_owned = ptr_is_owned(b);
54484         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54485         b_conv.is_owned = false;
54486         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
54487         return ret_conv;
54488 }
54489
54490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54491         LDKChannelFeatures a_conv;
54492         a_conv.inner = untag_ptr(a);
54493         a_conv.is_owned = ptr_is_owned(a);
54494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54495         a_conv.is_owned = false;
54496         LDKChannelFeatures b_conv;
54497         b_conv.inner = untag_ptr(b);
54498         b_conv.is_owned = ptr_is_owned(b);
54499         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54500         b_conv.is_owned = false;
54501         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
54502         return ret_conv;
54503 }
54504
54505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54506         LDKBolt11InvoiceFeatures a_conv;
54507         a_conv.inner = untag_ptr(a);
54508         a_conv.is_owned = ptr_is_owned(a);
54509         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54510         a_conv.is_owned = false;
54511         LDKBolt11InvoiceFeatures b_conv;
54512         b_conv.inner = untag_ptr(b);
54513         b_conv.is_owned = ptr_is_owned(b);
54514         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54515         b_conv.is_owned = false;
54516         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
54517         return ret_conv;
54518 }
54519
54520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54521         LDKOfferFeatures a_conv;
54522         a_conv.inner = untag_ptr(a);
54523         a_conv.is_owned = ptr_is_owned(a);
54524         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54525         a_conv.is_owned = false;
54526         LDKOfferFeatures b_conv;
54527         b_conv.inner = untag_ptr(b);
54528         b_conv.is_owned = ptr_is_owned(b);
54529         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54530         b_conv.is_owned = false;
54531         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
54532         return ret_conv;
54533 }
54534
54535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54536         LDKInvoiceRequestFeatures a_conv;
54537         a_conv.inner = untag_ptr(a);
54538         a_conv.is_owned = ptr_is_owned(a);
54539         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54540         a_conv.is_owned = false;
54541         LDKInvoiceRequestFeatures b_conv;
54542         b_conv.inner = untag_ptr(b);
54543         b_conv.is_owned = ptr_is_owned(b);
54544         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54545         b_conv.is_owned = false;
54546         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
54547         return ret_conv;
54548 }
54549
54550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54551         LDKBolt12InvoiceFeatures a_conv;
54552         a_conv.inner = untag_ptr(a);
54553         a_conv.is_owned = ptr_is_owned(a);
54554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54555         a_conv.is_owned = false;
54556         LDKBolt12InvoiceFeatures b_conv;
54557         b_conv.inner = untag_ptr(b);
54558         b_conv.is_owned = ptr_is_owned(b);
54559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54560         b_conv.is_owned = false;
54561         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
54562         return ret_conv;
54563 }
54564
54565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54566         LDKBlindedHopFeatures a_conv;
54567         a_conv.inner = untag_ptr(a);
54568         a_conv.is_owned = ptr_is_owned(a);
54569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54570         a_conv.is_owned = false;
54571         LDKBlindedHopFeatures b_conv;
54572         b_conv.inner = untag_ptr(b);
54573         b_conv.is_owned = ptr_is_owned(b);
54574         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54575         b_conv.is_owned = false;
54576         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
54577         return ret_conv;
54578 }
54579
54580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54581         LDKChannelTypeFeatures a_conv;
54582         a_conv.inner = untag_ptr(a);
54583         a_conv.is_owned = ptr_is_owned(a);
54584         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54585         a_conv.is_owned = false;
54586         LDKChannelTypeFeatures b_conv;
54587         b_conv.inner = untag_ptr(b);
54588         b_conv.is_owned = ptr_is_owned(b);
54589         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54590         b_conv.is_owned = false;
54591         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
54592         return ret_conv;
54593 }
54594
54595 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
54596         LDKInitFeatures ret_var = InitFeatures_clone(arg);
54597         int64_t ret_ref = 0;
54598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54600         return ret_ref;
54601 }
54602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54603         LDKInitFeatures arg_conv;
54604         arg_conv.inner = untag_ptr(arg);
54605         arg_conv.is_owned = ptr_is_owned(arg);
54606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54607         arg_conv.is_owned = false;
54608         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
54609         return ret_conv;
54610 }
54611
54612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54613         LDKInitFeatures orig_conv;
54614         orig_conv.inner = untag_ptr(orig);
54615         orig_conv.is_owned = ptr_is_owned(orig);
54616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54617         orig_conv.is_owned = false;
54618         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
54619         int64_t ret_ref = 0;
54620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54622         return ret_ref;
54623 }
54624
54625 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
54626         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
54627         int64_t ret_ref = 0;
54628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54630         return ret_ref;
54631 }
54632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54633         LDKNodeFeatures arg_conv;
54634         arg_conv.inner = untag_ptr(arg);
54635         arg_conv.is_owned = ptr_is_owned(arg);
54636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54637         arg_conv.is_owned = false;
54638         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
54639         return ret_conv;
54640 }
54641
54642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54643         LDKNodeFeatures orig_conv;
54644         orig_conv.inner = untag_ptr(orig);
54645         orig_conv.is_owned = ptr_is_owned(orig);
54646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54647         orig_conv.is_owned = false;
54648         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
54649         int64_t ret_ref = 0;
54650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54652         return ret_ref;
54653 }
54654
54655 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
54656         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
54657         int64_t ret_ref = 0;
54658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54660         return ret_ref;
54661 }
54662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54663         LDKChannelFeatures arg_conv;
54664         arg_conv.inner = untag_ptr(arg);
54665         arg_conv.is_owned = ptr_is_owned(arg);
54666         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54667         arg_conv.is_owned = false;
54668         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
54669         return ret_conv;
54670 }
54671
54672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54673         LDKChannelFeatures orig_conv;
54674         orig_conv.inner = untag_ptr(orig);
54675         orig_conv.is_owned = ptr_is_owned(orig);
54676         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54677         orig_conv.is_owned = false;
54678         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
54679         int64_t ret_ref = 0;
54680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54682         return ret_ref;
54683 }
54684
54685 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
54686         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
54687         int64_t ret_ref = 0;
54688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54690         return ret_ref;
54691 }
54692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54693         LDKBolt11InvoiceFeatures arg_conv;
54694         arg_conv.inner = untag_ptr(arg);
54695         arg_conv.is_owned = ptr_is_owned(arg);
54696         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54697         arg_conv.is_owned = false;
54698         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
54699         return ret_conv;
54700 }
54701
54702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54703         LDKBolt11InvoiceFeatures orig_conv;
54704         orig_conv.inner = untag_ptr(orig);
54705         orig_conv.is_owned = ptr_is_owned(orig);
54706         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54707         orig_conv.is_owned = false;
54708         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
54709         int64_t ret_ref = 0;
54710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54712         return ret_ref;
54713 }
54714
54715 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
54716         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
54717         int64_t ret_ref = 0;
54718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54720         return ret_ref;
54721 }
54722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54723         LDKOfferFeatures arg_conv;
54724         arg_conv.inner = untag_ptr(arg);
54725         arg_conv.is_owned = ptr_is_owned(arg);
54726         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54727         arg_conv.is_owned = false;
54728         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
54729         return ret_conv;
54730 }
54731
54732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54733         LDKOfferFeatures orig_conv;
54734         orig_conv.inner = untag_ptr(orig);
54735         orig_conv.is_owned = ptr_is_owned(orig);
54736         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54737         orig_conv.is_owned = false;
54738         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
54739         int64_t ret_ref = 0;
54740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54742         return ret_ref;
54743 }
54744
54745 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
54746         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
54747         int64_t ret_ref = 0;
54748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54750         return ret_ref;
54751 }
54752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54753         LDKInvoiceRequestFeatures arg_conv;
54754         arg_conv.inner = untag_ptr(arg);
54755         arg_conv.is_owned = ptr_is_owned(arg);
54756         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54757         arg_conv.is_owned = false;
54758         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
54759         return ret_conv;
54760 }
54761
54762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54763         LDKInvoiceRequestFeatures orig_conv;
54764         orig_conv.inner = untag_ptr(orig);
54765         orig_conv.is_owned = ptr_is_owned(orig);
54766         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54767         orig_conv.is_owned = false;
54768         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
54769         int64_t ret_ref = 0;
54770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54772         return ret_ref;
54773 }
54774
54775 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
54776         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
54777         int64_t ret_ref = 0;
54778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54780         return ret_ref;
54781 }
54782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54783         LDKBolt12InvoiceFeatures arg_conv;
54784         arg_conv.inner = untag_ptr(arg);
54785         arg_conv.is_owned = ptr_is_owned(arg);
54786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54787         arg_conv.is_owned = false;
54788         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
54789         return ret_conv;
54790 }
54791
54792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54793         LDKBolt12InvoiceFeatures orig_conv;
54794         orig_conv.inner = untag_ptr(orig);
54795         orig_conv.is_owned = ptr_is_owned(orig);
54796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54797         orig_conv.is_owned = false;
54798         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
54799         int64_t ret_ref = 0;
54800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54802         return ret_ref;
54803 }
54804
54805 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
54806         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
54807         int64_t ret_ref = 0;
54808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54810         return ret_ref;
54811 }
54812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54813         LDKBlindedHopFeatures arg_conv;
54814         arg_conv.inner = untag_ptr(arg);
54815         arg_conv.is_owned = ptr_is_owned(arg);
54816         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54817         arg_conv.is_owned = false;
54818         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
54819         return ret_conv;
54820 }
54821
54822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54823         LDKBlindedHopFeatures orig_conv;
54824         orig_conv.inner = untag_ptr(orig);
54825         orig_conv.is_owned = ptr_is_owned(orig);
54826         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54827         orig_conv.is_owned = false;
54828         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
54829         int64_t ret_ref = 0;
54830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54832         return ret_ref;
54833 }
54834
54835 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
54836         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
54837         int64_t ret_ref = 0;
54838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54840         return ret_ref;
54841 }
54842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54843         LDKChannelTypeFeatures arg_conv;
54844         arg_conv.inner = untag_ptr(arg);
54845         arg_conv.is_owned = ptr_is_owned(arg);
54846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54847         arg_conv.is_owned = false;
54848         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
54849         return ret_conv;
54850 }
54851
54852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54853         LDKChannelTypeFeatures orig_conv;
54854         orig_conv.inner = untag_ptr(orig);
54855         orig_conv.is_owned = ptr_is_owned(orig);
54856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54857         orig_conv.is_owned = false;
54858         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
54859         int64_t ret_ref = 0;
54860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54862         return ret_ref;
54863 }
54864
54865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54866         LDKInitFeatures this_obj_conv;
54867         this_obj_conv.inner = untag_ptr(this_obj);
54868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54870         InitFeatures_free(this_obj_conv);
54871 }
54872
54873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54874         LDKNodeFeatures this_obj_conv;
54875         this_obj_conv.inner = untag_ptr(this_obj);
54876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54878         NodeFeatures_free(this_obj_conv);
54879 }
54880
54881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54882         LDKChannelFeatures this_obj_conv;
54883         this_obj_conv.inner = untag_ptr(this_obj);
54884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54886         ChannelFeatures_free(this_obj_conv);
54887 }
54888
54889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54890         LDKBolt11InvoiceFeatures this_obj_conv;
54891         this_obj_conv.inner = untag_ptr(this_obj);
54892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54894         Bolt11InvoiceFeatures_free(this_obj_conv);
54895 }
54896
54897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54898         LDKOfferFeatures this_obj_conv;
54899         this_obj_conv.inner = untag_ptr(this_obj);
54900         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54902         OfferFeatures_free(this_obj_conv);
54903 }
54904
54905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54906         LDKInvoiceRequestFeatures this_obj_conv;
54907         this_obj_conv.inner = untag_ptr(this_obj);
54908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54910         InvoiceRequestFeatures_free(this_obj_conv);
54911 }
54912
54913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54914         LDKBolt12InvoiceFeatures this_obj_conv;
54915         this_obj_conv.inner = untag_ptr(this_obj);
54916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54918         Bolt12InvoiceFeatures_free(this_obj_conv);
54919 }
54920
54921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54922         LDKBlindedHopFeatures this_obj_conv;
54923         this_obj_conv.inner = untag_ptr(this_obj);
54924         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54926         BlindedHopFeatures_free(this_obj_conv);
54927 }
54928
54929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54930         LDKChannelTypeFeatures this_obj_conv;
54931         this_obj_conv.inner = untag_ptr(this_obj);
54932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54934         ChannelTypeFeatures_free(this_obj_conv);
54935 }
54936
54937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
54938         LDKInitFeatures ret_var = InitFeatures_empty();
54939         int64_t ret_ref = 0;
54940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54942         return ret_ref;
54943 }
54944
54945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
54946         LDKInitFeatures this_arg_conv;
54947         this_arg_conv.inner = untag_ptr(this_arg);
54948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54950         this_arg_conv.is_owned = false;
54951         LDKInitFeatures other_conv;
54952         other_conv.inner = untag_ptr(other);
54953         other_conv.is_owned = ptr_is_owned(other);
54954         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
54955         other_conv.is_owned = false;
54956         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
54957         return ret_conv;
54958 }
54959
54960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
54961         LDKInitFeatures this_arg_conv;
54962         this_arg_conv.inner = untag_ptr(this_arg);
54963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54965         this_arg_conv.is_owned = false;
54966         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
54967         return ret_conv;
54968 }
54969
54970 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) {
54971         LDKInitFeatures this_arg_conv;
54972         this_arg_conv.inner = untag_ptr(this_arg);
54973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54975         this_arg_conv.is_owned = false;
54976         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
54977         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
54978         return tag_ptr(ret_conv, true);
54979 }
54980
54981 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) {
54982         LDKInitFeatures this_arg_conv;
54983         this_arg_conv.inner = untag_ptr(this_arg);
54984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54986         this_arg_conv.is_owned = false;
54987         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
54988         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
54989         return tag_ptr(ret_conv, true);
54990 }
54991
54992 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) {
54993         LDKInitFeatures this_arg_conv;
54994         this_arg_conv.inner = untag_ptr(this_arg);
54995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54997         this_arg_conv.is_owned = false;
54998         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
54999         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55000         return tag_ptr(ret_conv, true);
55001 }
55002
55003 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) {
55004         LDKInitFeatures this_arg_conv;
55005         this_arg_conv.inner = untag_ptr(this_arg);
55006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55008         this_arg_conv.is_owned = false;
55009         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55010         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55011         return tag_ptr(ret_conv, true);
55012 }
55013
55014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
55015         LDKNodeFeatures ret_var = NodeFeatures_empty();
55016         int64_t ret_ref = 0;
55017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55019         return ret_ref;
55020 }
55021
55022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55023         LDKNodeFeatures this_arg_conv;
55024         this_arg_conv.inner = untag_ptr(this_arg);
55025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55027         this_arg_conv.is_owned = false;
55028         LDKNodeFeatures other_conv;
55029         other_conv.inner = untag_ptr(other);
55030         other_conv.is_owned = ptr_is_owned(other);
55031         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55032         other_conv.is_owned = false;
55033         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55034         return ret_conv;
55035 }
55036
55037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55038         LDKNodeFeatures this_arg_conv;
55039         this_arg_conv.inner = untag_ptr(this_arg);
55040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55042         this_arg_conv.is_owned = false;
55043         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55044         return ret_conv;
55045 }
55046
55047 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) {
55048         LDKNodeFeatures this_arg_conv;
55049         this_arg_conv.inner = untag_ptr(this_arg);
55050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55052         this_arg_conv.is_owned = false;
55053         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55054         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55055         return tag_ptr(ret_conv, true);
55056 }
55057
55058 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) {
55059         LDKNodeFeatures this_arg_conv;
55060         this_arg_conv.inner = untag_ptr(this_arg);
55061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55063         this_arg_conv.is_owned = false;
55064         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55065         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55066         return tag_ptr(ret_conv, true);
55067 }
55068
55069 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) {
55070         LDKNodeFeatures this_arg_conv;
55071         this_arg_conv.inner = untag_ptr(this_arg);
55072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55074         this_arg_conv.is_owned = false;
55075         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55076         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55077         return tag_ptr(ret_conv, true);
55078 }
55079
55080 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) {
55081         LDKNodeFeatures this_arg_conv;
55082         this_arg_conv.inner = untag_ptr(this_arg);
55083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55085         this_arg_conv.is_owned = false;
55086         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55087         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55088         return tag_ptr(ret_conv, true);
55089 }
55090
55091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
55092         LDKChannelFeatures ret_var = ChannelFeatures_empty();
55093         int64_t ret_ref = 0;
55094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55096         return ret_ref;
55097 }
55098
55099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55100         LDKChannelFeatures this_arg_conv;
55101         this_arg_conv.inner = untag_ptr(this_arg);
55102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55104         this_arg_conv.is_owned = false;
55105         LDKChannelFeatures other_conv;
55106         other_conv.inner = untag_ptr(other);
55107         other_conv.is_owned = ptr_is_owned(other);
55108         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55109         other_conv.is_owned = false;
55110         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55111         return ret_conv;
55112 }
55113
55114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55115         LDKChannelFeatures this_arg_conv;
55116         this_arg_conv.inner = untag_ptr(this_arg);
55117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55119         this_arg_conv.is_owned = false;
55120         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
55121         return ret_conv;
55122 }
55123
55124 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) {
55125         LDKChannelFeatures this_arg_conv;
55126         this_arg_conv.inner = untag_ptr(this_arg);
55127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55129         this_arg_conv.is_owned = false;
55130         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55131         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
55132         return tag_ptr(ret_conv, true);
55133 }
55134
55135 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) {
55136         LDKChannelFeatures this_arg_conv;
55137         this_arg_conv.inner = untag_ptr(this_arg);
55138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55140         this_arg_conv.is_owned = false;
55141         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55142         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55143         return tag_ptr(ret_conv, true);
55144 }
55145
55146 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) {
55147         LDKChannelFeatures this_arg_conv;
55148         this_arg_conv.inner = untag_ptr(this_arg);
55149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55151         this_arg_conv.is_owned = false;
55152         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55153         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
55154         return tag_ptr(ret_conv, true);
55155 }
55156
55157 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) {
55158         LDKChannelFeatures this_arg_conv;
55159         this_arg_conv.inner = untag_ptr(this_arg);
55160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55162         this_arg_conv.is_owned = false;
55163         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55164         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55165         return tag_ptr(ret_conv, true);
55166 }
55167
55168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
55169         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
55170         int64_t ret_ref = 0;
55171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55173         return ret_ref;
55174 }
55175
55176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55177         LDKBolt11InvoiceFeatures this_arg_conv;
55178         this_arg_conv.inner = untag_ptr(this_arg);
55179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55181         this_arg_conv.is_owned = false;
55182         LDKBolt11InvoiceFeatures other_conv;
55183         other_conv.inner = untag_ptr(other);
55184         other_conv.is_owned = ptr_is_owned(other);
55185         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55186         other_conv.is_owned = false;
55187         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55188         return ret_conv;
55189 }
55190
55191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55192         LDKBolt11InvoiceFeatures this_arg_conv;
55193         this_arg_conv.inner = untag_ptr(this_arg);
55194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55196         this_arg_conv.is_owned = false;
55197         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55198         return ret_conv;
55199 }
55200
55201 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) {
55202         LDKBolt11InvoiceFeatures this_arg_conv;
55203         this_arg_conv.inner = untag_ptr(this_arg);
55204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55206         this_arg_conv.is_owned = false;
55207         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55208         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55209         return tag_ptr(ret_conv, true);
55210 }
55211
55212 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) {
55213         LDKBolt11InvoiceFeatures this_arg_conv;
55214         this_arg_conv.inner = untag_ptr(this_arg);
55215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55217         this_arg_conv.is_owned = false;
55218         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55219         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55220         return tag_ptr(ret_conv, true);
55221 }
55222
55223 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) {
55224         LDKBolt11InvoiceFeatures this_arg_conv;
55225         this_arg_conv.inner = untag_ptr(this_arg);
55226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55228         this_arg_conv.is_owned = false;
55229         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55230         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55231         return tag_ptr(ret_conv, true);
55232 }
55233
55234 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) {
55235         LDKBolt11InvoiceFeatures this_arg_conv;
55236         this_arg_conv.inner = untag_ptr(this_arg);
55237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55239         this_arg_conv.is_owned = false;
55240         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55241         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55242         return tag_ptr(ret_conv, true);
55243 }
55244
55245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
55246         LDKOfferFeatures ret_var = OfferFeatures_empty();
55247         int64_t ret_ref = 0;
55248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55250         return ret_ref;
55251 }
55252
55253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55254         LDKOfferFeatures this_arg_conv;
55255         this_arg_conv.inner = untag_ptr(this_arg);
55256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55258         this_arg_conv.is_owned = false;
55259         LDKOfferFeatures other_conv;
55260         other_conv.inner = untag_ptr(other);
55261         other_conv.is_owned = ptr_is_owned(other);
55262         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55263         other_conv.is_owned = false;
55264         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55265         return ret_conv;
55266 }
55267
55268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55269         LDKOfferFeatures this_arg_conv;
55270         this_arg_conv.inner = untag_ptr(this_arg);
55271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55273         this_arg_conv.is_owned = false;
55274         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
55275         return ret_conv;
55276 }
55277
55278 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) {
55279         LDKOfferFeatures this_arg_conv;
55280         this_arg_conv.inner = untag_ptr(this_arg);
55281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55283         this_arg_conv.is_owned = false;
55284         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55285         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
55286         return tag_ptr(ret_conv, true);
55287 }
55288
55289 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) {
55290         LDKOfferFeatures this_arg_conv;
55291         this_arg_conv.inner = untag_ptr(this_arg);
55292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55294         this_arg_conv.is_owned = false;
55295         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55296         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55297         return tag_ptr(ret_conv, true);
55298 }
55299
55300 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) {
55301         LDKOfferFeatures this_arg_conv;
55302         this_arg_conv.inner = untag_ptr(this_arg);
55303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55305         this_arg_conv.is_owned = false;
55306         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55307         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
55308         return tag_ptr(ret_conv, true);
55309 }
55310
55311 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) {
55312         LDKOfferFeatures this_arg_conv;
55313         this_arg_conv.inner = untag_ptr(this_arg);
55314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55316         this_arg_conv.is_owned = false;
55317         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55318         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55319         return tag_ptr(ret_conv, true);
55320 }
55321
55322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
55323         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
55324         int64_t ret_ref = 0;
55325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55327         return ret_ref;
55328 }
55329
55330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55331         LDKInvoiceRequestFeatures this_arg_conv;
55332         this_arg_conv.inner = untag_ptr(this_arg);
55333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55335         this_arg_conv.is_owned = false;
55336         LDKInvoiceRequestFeatures other_conv;
55337         other_conv.inner = untag_ptr(other);
55338         other_conv.is_owned = ptr_is_owned(other);
55339         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55340         other_conv.is_owned = false;
55341         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55342         return ret_conv;
55343 }
55344
55345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55346         LDKInvoiceRequestFeatures this_arg_conv;
55347         this_arg_conv.inner = untag_ptr(this_arg);
55348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55350         this_arg_conv.is_owned = false;
55351         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
55352         return ret_conv;
55353 }
55354
55355 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) {
55356         LDKInvoiceRequestFeatures this_arg_conv;
55357         this_arg_conv.inner = untag_ptr(this_arg);
55358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55360         this_arg_conv.is_owned = false;
55361         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55362         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
55363         return tag_ptr(ret_conv, true);
55364 }
55365
55366 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) {
55367         LDKInvoiceRequestFeatures this_arg_conv;
55368         this_arg_conv.inner = untag_ptr(this_arg);
55369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55371         this_arg_conv.is_owned = false;
55372         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55373         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55374         return tag_ptr(ret_conv, true);
55375 }
55376
55377 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) {
55378         LDKInvoiceRequestFeatures this_arg_conv;
55379         this_arg_conv.inner = untag_ptr(this_arg);
55380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55382         this_arg_conv.is_owned = false;
55383         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55384         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
55385         return tag_ptr(ret_conv, true);
55386 }
55387
55388 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) {
55389         LDKInvoiceRequestFeatures this_arg_conv;
55390         this_arg_conv.inner = untag_ptr(this_arg);
55391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55393         this_arg_conv.is_owned = false;
55394         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55395         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55396         return tag_ptr(ret_conv, true);
55397 }
55398
55399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
55400         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
55401         int64_t ret_ref = 0;
55402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55404         return ret_ref;
55405 }
55406
55407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55408         LDKBolt12InvoiceFeatures this_arg_conv;
55409         this_arg_conv.inner = untag_ptr(this_arg);
55410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55412         this_arg_conv.is_owned = false;
55413         LDKBolt12InvoiceFeatures other_conv;
55414         other_conv.inner = untag_ptr(other);
55415         other_conv.is_owned = ptr_is_owned(other);
55416         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55417         other_conv.is_owned = false;
55418         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55419         return ret_conv;
55420 }
55421
55422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55423         LDKBolt12InvoiceFeatures this_arg_conv;
55424         this_arg_conv.inner = untag_ptr(this_arg);
55425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55427         this_arg_conv.is_owned = false;
55428         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55429         return ret_conv;
55430 }
55431
55432 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) {
55433         LDKBolt12InvoiceFeatures this_arg_conv;
55434         this_arg_conv.inner = untag_ptr(this_arg);
55435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55437         this_arg_conv.is_owned = false;
55438         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55439         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55440         return tag_ptr(ret_conv, true);
55441 }
55442
55443 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) {
55444         LDKBolt12InvoiceFeatures this_arg_conv;
55445         this_arg_conv.inner = untag_ptr(this_arg);
55446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55448         this_arg_conv.is_owned = false;
55449         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55450         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55451         return tag_ptr(ret_conv, true);
55452 }
55453
55454 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) {
55455         LDKBolt12InvoiceFeatures this_arg_conv;
55456         this_arg_conv.inner = untag_ptr(this_arg);
55457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55459         this_arg_conv.is_owned = false;
55460         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55461         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55462         return tag_ptr(ret_conv, true);
55463 }
55464
55465 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) {
55466         LDKBolt12InvoiceFeatures this_arg_conv;
55467         this_arg_conv.inner = untag_ptr(this_arg);
55468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55470         this_arg_conv.is_owned = false;
55471         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55472         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55473         return tag_ptr(ret_conv, true);
55474 }
55475
55476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
55477         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
55478         int64_t ret_ref = 0;
55479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55481         return ret_ref;
55482 }
55483
55484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55485         LDKBlindedHopFeatures this_arg_conv;
55486         this_arg_conv.inner = untag_ptr(this_arg);
55487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55489         this_arg_conv.is_owned = false;
55490         LDKBlindedHopFeatures other_conv;
55491         other_conv.inner = untag_ptr(other);
55492         other_conv.is_owned = ptr_is_owned(other);
55493         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55494         other_conv.is_owned = false;
55495         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55496         return ret_conv;
55497 }
55498
55499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55500         LDKBlindedHopFeatures this_arg_conv;
55501         this_arg_conv.inner = untag_ptr(this_arg);
55502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55504         this_arg_conv.is_owned = false;
55505         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
55506         return ret_conv;
55507 }
55508
55509 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) {
55510         LDKBlindedHopFeatures this_arg_conv;
55511         this_arg_conv.inner = untag_ptr(this_arg);
55512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55514         this_arg_conv.is_owned = false;
55515         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55516         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
55517         return tag_ptr(ret_conv, true);
55518 }
55519
55520 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) {
55521         LDKBlindedHopFeatures this_arg_conv;
55522         this_arg_conv.inner = untag_ptr(this_arg);
55523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55525         this_arg_conv.is_owned = false;
55526         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55527         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55528         return tag_ptr(ret_conv, true);
55529 }
55530
55531 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) {
55532         LDKBlindedHopFeatures this_arg_conv;
55533         this_arg_conv.inner = untag_ptr(this_arg);
55534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55536         this_arg_conv.is_owned = false;
55537         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55538         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
55539         return tag_ptr(ret_conv, true);
55540 }
55541
55542 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) {
55543         LDKBlindedHopFeatures this_arg_conv;
55544         this_arg_conv.inner = untag_ptr(this_arg);
55545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55547         this_arg_conv.is_owned = false;
55548         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55549         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55550         return tag_ptr(ret_conv, true);
55551 }
55552
55553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
55554         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
55555         int64_t ret_ref = 0;
55556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55558         return ret_ref;
55559 }
55560
55561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55562         LDKChannelTypeFeatures this_arg_conv;
55563         this_arg_conv.inner = untag_ptr(this_arg);
55564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55566         this_arg_conv.is_owned = false;
55567         LDKChannelTypeFeatures other_conv;
55568         other_conv.inner = untag_ptr(other);
55569         other_conv.is_owned = ptr_is_owned(other);
55570         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55571         other_conv.is_owned = false;
55572         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55573         return ret_conv;
55574 }
55575
55576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55577         LDKChannelTypeFeatures this_arg_conv;
55578         this_arg_conv.inner = untag_ptr(this_arg);
55579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55581         this_arg_conv.is_owned = false;
55582         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
55583         return ret_conv;
55584 }
55585
55586 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) {
55587         LDKChannelTypeFeatures this_arg_conv;
55588         this_arg_conv.inner = untag_ptr(this_arg);
55589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55591         this_arg_conv.is_owned = false;
55592         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55593         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55594         return tag_ptr(ret_conv, true);
55595 }
55596
55597 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) {
55598         LDKChannelTypeFeatures this_arg_conv;
55599         this_arg_conv.inner = untag_ptr(this_arg);
55600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55602         this_arg_conv.is_owned = false;
55603         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55604         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55605         return tag_ptr(ret_conv, true);
55606 }
55607
55608 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) {
55609         LDKChannelTypeFeatures this_arg_conv;
55610         this_arg_conv.inner = untag_ptr(this_arg);
55611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55613         this_arg_conv.is_owned = false;
55614         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55615         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55616         return tag_ptr(ret_conv, true);
55617 }
55618
55619 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) {
55620         LDKChannelTypeFeatures this_arg_conv;
55621         this_arg_conv.inner = untag_ptr(this_arg);
55622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55624         this_arg_conv.is_owned = false;
55625         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55626         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55627         return tag_ptr(ret_conv, true);
55628 }
55629
55630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55631         LDKInitFeatures obj_conv;
55632         obj_conv.inner = untag_ptr(obj);
55633         obj_conv.is_owned = ptr_is_owned(obj);
55634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55635         obj_conv.is_owned = false;
55636         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
55637         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55638         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55639         CVec_u8Z_free(ret_var);
55640         return ret_arr;
55641 }
55642
55643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55644         LDKu8slice ser_ref;
55645         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55646         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55647         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
55648         *ret_conv = InitFeatures_read(ser_ref);
55649         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55650         return tag_ptr(ret_conv, true);
55651 }
55652
55653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55654         LDKChannelFeatures obj_conv;
55655         obj_conv.inner = untag_ptr(obj);
55656         obj_conv.is_owned = ptr_is_owned(obj);
55657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55658         obj_conv.is_owned = false;
55659         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
55660         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55661         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55662         CVec_u8Z_free(ret_var);
55663         return ret_arr;
55664 }
55665
55666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55667         LDKu8slice ser_ref;
55668         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55669         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55670         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
55671         *ret_conv = ChannelFeatures_read(ser_ref);
55672         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55673         return tag_ptr(ret_conv, true);
55674 }
55675
55676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55677         LDKNodeFeatures obj_conv;
55678         obj_conv.inner = untag_ptr(obj);
55679         obj_conv.is_owned = ptr_is_owned(obj);
55680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55681         obj_conv.is_owned = false;
55682         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
55683         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55684         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55685         CVec_u8Z_free(ret_var);
55686         return ret_arr;
55687 }
55688
55689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55690         LDKu8slice ser_ref;
55691         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55692         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55693         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
55694         *ret_conv = NodeFeatures_read(ser_ref);
55695         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55696         return tag_ptr(ret_conv, true);
55697 }
55698
55699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55700         LDKBolt11InvoiceFeatures obj_conv;
55701         obj_conv.inner = untag_ptr(obj);
55702         obj_conv.is_owned = ptr_is_owned(obj);
55703         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55704         obj_conv.is_owned = false;
55705         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
55706         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55707         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55708         CVec_u8Z_free(ret_var);
55709         return ret_arr;
55710 }
55711
55712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55713         LDKu8slice ser_ref;
55714         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55715         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55716         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
55717         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
55718         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55719         return tag_ptr(ret_conv, true);
55720 }
55721
55722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55723         LDKBolt12InvoiceFeatures obj_conv;
55724         obj_conv.inner = untag_ptr(obj);
55725         obj_conv.is_owned = ptr_is_owned(obj);
55726         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55727         obj_conv.is_owned = false;
55728         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
55729         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55730         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55731         CVec_u8Z_free(ret_var);
55732         return ret_arr;
55733 }
55734
55735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55736         LDKu8slice ser_ref;
55737         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55738         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55739         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
55740         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
55741         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55742         return tag_ptr(ret_conv, true);
55743 }
55744
55745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55746         LDKBlindedHopFeatures obj_conv;
55747         obj_conv.inner = untag_ptr(obj);
55748         obj_conv.is_owned = ptr_is_owned(obj);
55749         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55750         obj_conv.is_owned = false;
55751         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
55752         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55753         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55754         CVec_u8Z_free(ret_var);
55755         return ret_arr;
55756 }
55757
55758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55759         LDKu8slice ser_ref;
55760         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55761         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55762         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
55763         *ret_conv = BlindedHopFeatures_read(ser_ref);
55764         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55765         return tag_ptr(ret_conv, true);
55766 }
55767
55768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55769         LDKChannelTypeFeatures obj_conv;
55770         obj_conv.inner = untag_ptr(obj);
55771         obj_conv.is_owned = ptr_is_owned(obj);
55772         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55773         obj_conv.is_owned = false;
55774         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
55775         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55776         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55777         CVec_u8Z_free(ret_var);
55778         return ret_arr;
55779 }
55780
55781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55782         LDKu8slice ser_ref;
55783         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55784         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55785         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
55786         *ret_conv = ChannelTypeFeatures_read(ser_ref);
55787         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55788         return tag_ptr(ret_conv, true);
55789 }
55790
55791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55792         LDKInitFeatures this_arg_conv;
55793         this_arg_conv.inner = untag_ptr(this_arg);
55794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55796         this_arg_conv.is_owned = false;
55797         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
55798 }
55799
55800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55801         LDKInitFeatures this_arg_conv;
55802         this_arg_conv.inner = untag_ptr(this_arg);
55803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55805         this_arg_conv.is_owned = false;
55806         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
55807 }
55808
55809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55810         LDKInitFeatures this_arg_conv;
55811         this_arg_conv.inner = untag_ptr(this_arg);
55812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55814         this_arg_conv.is_owned = false;
55815         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
55816         return ret_conv;
55817 }
55818
55819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55820         LDKNodeFeatures this_arg_conv;
55821         this_arg_conv.inner = untag_ptr(this_arg);
55822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55824         this_arg_conv.is_owned = false;
55825         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
55826 }
55827
55828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55829         LDKNodeFeatures this_arg_conv;
55830         this_arg_conv.inner = untag_ptr(this_arg);
55831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55833         this_arg_conv.is_owned = false;
55834         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
55835 }
55836
55837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55838         LDKNodeFeatures this_arg_conv;
55839         this_arg_conv.inner = untag_ptr(this_arg);
55840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55842         this_arg_conv.is_owned = false;
55843         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
55844         return ret_conv;
55845 }
55846
55847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55848         LDKInitFeatures this_arg_conv;
55849         this_arg_conv.inner = untag_ptr(this_arg);
55850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55852         this_arg_conv.is_owned = false;
55853         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
55854         return ret_conv;
55855 }
55856
55857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55858         LDKNodeFeatures this_arg_conv;
55859         this_arg_conv.inner = untag_ptr(this_arg);
55860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55862         this_arg_conv.is_owned = false;
55863         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
55864         return ret_conv;
55865 }
55866
55867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55868         LDKInitFeatures this_arg_conv;
55869         this_arg_conv.inner = untag_ptr(this_arg);
55870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55872         this_arg_conv.is_owned = false;
55873         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
55874 }
55875
55876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55877         LDKInitFeatures this_arg_conv;
55878         this_arg_conv.inner = untag_ptr(this_arg);
55879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55881         this_arg_conv.is_owned = false;
55882         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
55883 }
55884
55885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
55886         LDKInitFeatures this_arg_conv;
55887         this_arg_conv.inner = untag_ptr(this_arg);
55888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55890         this_arg_conv.is_owned = false;
55891         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
55892         return ret_conv;
55893 }
55894
55895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55896         LDKInitFeatures this_arg_conv;
55897         this_arg_conv.inner = untag_ptr(this_arg);
55898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55900         this_arg_conv.is_owned = false;
55901         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
55902 }
55903
55904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55905         LDKInitFeatures this_arg_conv;
55906         this_arg_conv.inner = untag_ptr(this_arg);
55907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55909         this_arg_conv.is_owned = false;
55910         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
55911 }
55912
55913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55914         LDKInitFeatures this_arg_conv;
55915         this_arg_conv.inner = untag_ptr(this_arg);
55916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55918         this_arg_conv.is_owned = false;
55919         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
55920         return ret_conv;
55921 }
55922
55923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55924         LDKNodeFeatures this_arg_conv;
55925         this_arg_conv.inner = untag_ptr(this_arg);
55926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55928         this_arg_conv.is_owned = false;
55929         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
55930 }
55931
55932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55933         LDKNodeFeatures this_arg_conv;
55934         this_arg_conv.inner = untag_ptr(this_arg);
55935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55937         this_arg_conv.is_owned = false;
55938         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
55939 }
55940
55941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55942         LDKNodeFeatures this_arg_conv;
55943         this_arg_conv.inner = untag_ptr(this_arg);
55944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55946         this_arg_conv.is_owned = false;
55947         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
55948         return ret_conv;
55949 }
55950
55951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55952         LDKInitFeatures this_arg_conv;
55953         this_arg_conv.inner = untag_ptr(this_arg);
55954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55956         this_arg_conv.is_owned = false;
55957         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
55958         return ret_conv;
55959 }
55960
55961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55962         LDKNodeFeatures this_arg_conv;
55963         this_arg_conv.inner = untag_ptr(this_arg);
55964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55966         this_arg_conv.is_owned = false;
55967         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
55968         return ret_conv;
55969 }
55970
55971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55972         LDKInitFeatures this_arg_conv;
55973         this_arg_conv.inner = untag_ptr(this_arg);
55974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55976         this_arg_conv.is_owned = false;
55977         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
55978 }
55979
55980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55981         LDKInitFeatures this_arg_conv;
55982         this_arg_conv.inner = untag_ptr(this_arg);
55983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55985         this_arg_conv.is_owned = false;
55986         InitFeatures_set_gossip_queries_required(&this_arg_conv);
55987 }
55988
55989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
55990         LDKInitFeatures this_arg_conv;
55991         this_arg_conv.inner = untag_ptr(this_arg);
55992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55994         this_arg_conv.is_owned = false;
55995         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
55996         return ret_conv;
55997 }
55998
55999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56000         LDKNodeFeatures this_arg_conv;
56001         this_arg_conv.inner = untag_ptr(this_arg);
56002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56004         this_arg_conv.is_owned = false;
56005         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56006 }
56007
56008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56009         LDKNodeFeatures this_arg_conv;
56010         this_arg_conv.inner = untag_ptr(this_arg);
56011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56013         this_arg_conv.is_owned = false;
56014         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56015 }
56016
56017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56018         LDKNodeFeatures this_arg_conv;
56019         this_arg_conv.inner = untag_ptr(this_arg);
56020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56022         this_arg_conv.is_owned = false;
56023         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56024         return ret_conv;
56025 }
56026
56027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56028         LDKInitFeatures this_arg_conv;
56029         this_arg_conv.inner = untag_ptr(this_arg);
56030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56032         this_arg_conv.is_owned = false;
56033         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56034         return ret_conv;
56035 }
56036
56037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56038         LDKNodeFeatures this_arg_conv;
56039         this_arg_conv.inner = untag_ptr(this_arg);
56040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56042         this_arg_conv.is_owned = false;
56043         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56044         return ret_conv;
56045 }
56046
56047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56048         LDKInitFeatures this_arg_conv;
56049         this_arg_conv.inner = untag_ptr(this_arg);
56050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56052         this_arg_conv.is_owned = false;
56053         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
56054 }
56055
56056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56057         LDKInitFeatures this_arg_conv;
56058         this_arg_conv.inner = untag_ptr(this_arg);
56059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56061         this_arg_conv.is_owned = false;
56062         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
56063 }
56064
56065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56066         LDKInitFeatures this_arg_conv;
56067         this_arg_conv.inner = untag_ptr(this_arg);
56068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56070         this_arg_conv.is_owned = false;
56071         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
56072         return ret_conv;
56073 }
56074
56075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56076         LDKNodeFeatures this_arg_conv;
56077         this_arg_conv.inner = untag_ptr(this_arg);
56078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56080         this_arg_conv.is_owned = false;
56081         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
56082 }
56083
56084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56085         LDKNodeFeatures this_arg_conv;
56086         this_arg_conv.inner = untag_ptr(this_arg);
56087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56089         this_arg_conv.is_owned = false;
56090         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
56091 }
56092
56093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56094         LDKNodeFeatures this_arg_conv;
56095         this_arg_conv.inner = untag_ptr(this_arg);
56096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56098         this_arg_conv.is_owned = false;
56099         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
56100         return ret_conv;
56101 }
56102
56103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56104         LDKBolt11InvoiceFeatures this_arg_conv;
56105         this_arg_conv.inner = untag_ptr(this_arg);
56106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56108         this_arg_conv.is_owned = false;
56109         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
56110 }
56111
56112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56113         LDKBolt11InvoiceFeatures this_arg_conv;
56114         this_arg_conv.inner = untag_ptr(this_arg);
56115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56117         this_arg_conv.is_owned = false;
56118         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
56119 }
56120
56121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56122         LDKBolt11InvoiceFeatures this_arg_conv;
56123         this_arg_conv.inner = untag_ptr(this_arg);
56124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56126         this_arg_conv.is_owned = false;
56127         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
56128         return ret_conv;
56129 }
56130
56131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56132         LDKInitFeatures this_arg_conv;
56133         this_arg_conv.inner = untag_ptr(this_arg);
56134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56136         this_arg_conv.is_owned = false;
56137         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
56138         return ret_conv;
56139 }
56140
56141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56142         LDKNodeFeatures this_arg_conv;
56143         this_arg_conv.inner = untag_ptr(this_arg);
56144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56146         this_arg_conv.is_owned = false;
56147         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
56148         return ret_conv;
56149 }
56150
56151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56152         LDKBolt11InvoiceFeatures this_arg_conv;
56153         this_arg_conv.inner = untag_ptr(this_arg);
56154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56156         this_arg_conv.is_owned = false;
56157         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
56158         return ret_conv;
56159 }
56160
56161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56162         LDKInitFeatures this_arg_conv;
56163         this_arg_conv.inner = untag_ptr(this_arg);
56164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56166         this_arg_conv.is_owned = false;
56167         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
56168 }
56169
56170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56171         LDKInitFeatures this_arg_conv;
56172         this_arg_conv.inner = untag_ptr(this_arg);
56173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56175         this_arg_conv.is_owned = false;
56176         InitFeatures_set_static_remote_key_required(&this_arg_conv);
56177 }
56178
56179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56180         LDKInitFeatures this_arg_conv;
56181         this_arg_conv.inner = untag_ptr(this_arg);
56182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56184         this_arg_conv.is_owned = false;
56185         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
56186         return ret_conv;
56187 }
56188
56189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56190         LDKNodeFeatures this_arg_conv;
56191         this_arg_conv.inner = untag_ptr(this_arg);
56192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56194         this_arg_conv.is_owned = false;
56195         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
56196 }
56197
56198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56199         LDKNodeFeatures this_arg_conv;
56200         this_arg_conv.inner = untag_ptr(this_arg);
56201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56203         this_arg_conv.is_owned = false;
56204         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
56205 }
56206
56207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56208         LDKNodeFeatures this_arg_conv;
56209         this_arg_conv.inner = untag_ptr(this_arg);
56210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56212         this_arg_conv.is_owned = false;
56213         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
56214         return ret_conv;
56215 }
56216
56217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56218         LDKChannelTypeFeatures this_arg_conv;
56219         this_arg_conv.inner = untag_ptr(this_arg);
56220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56222         this_arg_conv.is_owned = false;
56223         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
56224 }
56225
56226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56227         LDKChannelTypeFeatures this_arg_conv;
56228         this_arg_conv.inner = untag_ptr(this_arg);
56229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56231         this_arg_conv.is_owned = false;
56232         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
56233 }
56234
56235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56236         LDKChannelTypeFeatures this_arg_conv;
56237         this_arg_conv.inner = untag_ptr(this_arg);
56238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56240         this_arg_conv.is_owned = false;
56241         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
56242         return ret_conv;
56243 }
56244
56245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56246         LDKInitFeatures this_arg_conv;
56247         this_arg_conv.inner = untag_ptr(this_arg);
56248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56250         this_arg_conv.is_owned = false;
56251         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
56252         return ret_conv;
56253 }
56254
56255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56256         LDKNodeFeatures this_arg_conv;
56257         this_arg_conv.inner = untag_ptr(this_arg);
56258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56260         this_arg_conv.is_owned = false;
56261         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
56262         return ret_conv;
56263 }
56264
56265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56266         LDKChannelTypeFeatures this_arg_conv;
56267         this_arg_conv.inner = untag_ptr(this_arg);
56268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56270         this_arg_conv.is_owned = false;
56271         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
56272         return ret_conv;
56273 }
56274
56275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56276         LDKInitFeatures this_arg_conv;
56277         this_arg_conv.inner = untag_ptr(this_arg);
56278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56280         this_arg_conv.is_owned = false;
56281         InitFeatures_set_payment_secret_optional(&this_arg_conv);
56282 }
56283
56284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56285         LDKInitFeatures this_arg_conv;
56286         this_arg_conv.inner = untag_ptr(this_arg);
56287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56289         this_arg_conv.is_owned = false;
56290         InitFeatures_set_payment_secret_required(&this_arg_conv);
56291 }
56292
56293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56294         LDKInitFeatures this_arg_conv;
56295         this_arg_conv.inner = untag_ptr(this_arg);
56296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56298         this_arg_conv.is_owned = false;
56299         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
56300         return ret_conv;
56301 }
56302
56303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56304         LDKNodeFeatures this_arg_conv;
56305         this_arg_conv.inner = untag_ptr(this_arg);
56306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56308         this_arg_conv.is_owned = false;
56309         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
56310 }
56311
56312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56313         LDKNodeFeatures this_arg_conv;
56314         this_arg_conv.inner = untag_ptr(this_arg);
56315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56317         this_arg_conv.is_owned = false;
56318         NodeFeatures_set_payment_secret_required(&this_arg_conv);
56319 }
56320
56321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56322         LDKNodeFeatures this_arg_conv;
56323         this_arg_conv.inner = untag_ptr(this_arg);
56324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56326         this_arg_conv.is_owned = false;
56327         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
56328         return ret_conv;
56329 }
56330
56331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56332         LDKBolt11InvoiceFeatures this_arg_conv;
56333         this_arg_conv.inner = untag_ptr(this_arg);
56334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56336         this_arg_conv.is_owned = false;
56337         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
56338 }
56339
56340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56341         LDKBolt11InvoiceFeatures this_arg_conv;
56342         this_arg_conv.inner = untag_ptr(this_arg);
56343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56345         this_arg_conv.is_owned = false;
56346         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
56347 }
56348
56349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56350         LDKBolt11InvoiceFeatures this_arg_conv;
56351         this_arg_conv.inner = untag_ptr(this_arg);
56352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56354         this_arg_conv.is_owned = false;
56355         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
56356         return ret_conv;
56357 }
56358
56359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56360         LDKInitFeatures this_arg_conv;
56361         this_arg_conv.inner = untag_ptr(this_arg);
56362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56364         this_arg_conv.is_owned = false;
56365         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
56366         return ret_conv;
56367 }
56368
56369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56370         LDKNodeFeatures this_arg_conv;
56371         this_arg_conv.inner = untag_ptr(this_arg);
56372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56374         this_arg_conv.is_owned = false;
56375         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
56376         return ret_conv;
56377 }
56378
56379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56380         LDKBolt11InvoiceFeatures this_arg_conv;
56381         this_arg_conv.inner = untag_ptr(this_arg);
56382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56384         this_arg_conv.is_owned = false;
56385         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
56386         return ret_conv;
56387 }
56388
56389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56390         LDKInitFeatures this_arg_conv;
56391         this_arg_conv.inner = untag_ptr(this_arg);
56392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56394         this_arg_conv.is_owned = false;
56395         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
56396 }
56397
56398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56399         LDKInitFeatures this_arg_conv;
56400         this_arg_conv.inner = untag_ptr(this_arg);
56401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56403         this_arg_conv.is_owned = false;
56404         InitFeatures_set_basic_mpp_required(&this_arg_conv);
56405 }
56406
56407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56408         LDKInitFeatures this_arg_conv;
56409         this_arg_conv.inner = untag_ptr(this_arg);
56410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56412         this_arg_conv.is_owned = false;
56413         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
56414         return ret_conv;
56415 }
56416
56417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56418         LDKNodeFeatures this_arg_conv;
56419         this_arg_conv.inner = untag_ptr(this_arg);
56420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56422         this_arg_conv.is_owned = false;
56423         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
56424 }
56425
56426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56427         LDKNodeFeatures this_arg_conv;
56428         this_arg_conv.inner = untag_ptr(this_arg);
56429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56431         this_arg_conv.is_owned = false;
56432         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
56433 }
56434
56435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56436         LDKNodeFeatures this_arg_conv;
56437         this_arg_conv.inner = untag_ptr(this_arg);
56438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56440         this_arg_conv.is_owned = false;
56441         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
56442         return ret_conv;
56443 }
56444
56445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56446         LDKBolt11InvoiceFeatures this_arg_conv;
56447         this_arg_conv.inner = untag_ptr(this_arg);
56448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56450         this_arg_conv.is_owned = false;
56451         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
56452 }
56453
56454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56455         LDKBolt11InvoiceFeatures this_arg_conv;
56456         this_arg_conv.inner = untag_ptr(this_arg);
56457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56459         this_arg_conv.is_owned = false;
56460         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
56461 }
56462
56463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56464         LDKBolt11InvoiceFeatures this_arg_conv;
56465         this_arg_conv.inner = untag_ptr(this_arg);
56466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56468         this_arg_conv.is_owned = false;
56469         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
56470         return ret_conv;
56471 }
56472
56473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56474         LDKBolt12InvoiceFeatures this_arg_conv;
56475         this_arg_conv.inner = untag_ptr(this_arg);
56476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56478         this_arg_conv.is_owned = false;
56479         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
56480 }
56481
56482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56483         LDKBolt12InvoiceFeatures this_arg_conv;
56484         this_arg_conv.inner = untag_ptr(this_arg);
56485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56487         this_arg_conv.is_owned = false;
56488         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
56489 }
56490
56491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56492         LDKBolt12InvoiceFeatures this_arg_conv;
56493         this_arg_conv.inner = untag_ptr(this_arg);
56494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56496         this_arg_conv.is_owned = false;
56497         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
56498         return ret_conv;
56499 }
56500
56501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56502         LDKInitFeatures this_arg_conv;
56503         this_arg_conv.inner = untag_ptr(this_arg);
56504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56506         this_arg_conv.is_owned = false;
56507         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
56508         return ret_conv;
56509 }
56510
56511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56512         LDKNodeFeatures this_arg_conv;
56513         this_arg_conv.inner = untag_ptr(this_arg);
56514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56516         this_arg_conv.is_owned = false;
56517         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
56518         return ret_conv;
56519 }
56520
56521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56522         LDKBolt11InvoiceFeatures this_arg_conv;
56523         this_arg_conv.inner = untag_ptr(this_arg);
56524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56526         this_arg_conv.is_owned = false;
56527         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
56528         return ret_conv;
56529 }
56530
56531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56532         LDKBolt12InvoiceFeatures this_arg_conv;
56533         this_arg_conv.inner = untag_ptr(this_arg);
56534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56536         this_arg_conv.is_owned = false;
56537         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
56538         return ret_conv;
56539 }
56540
56541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56542         LDKInitFeatures this_arg_conv;
56543         this_arg_conv.inner = untag_ptr(this_arg);
56544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56546         this_arg_conv.is_owned = false;
56547         InitFeatures_set_wumbo_optional(&this_arg_conv);
56548 }
56549
56550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56551         LDKInitFeatures this_arg_conv;
56552         this_arg_conv.inner = untag_ptr(this_arg);
56553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56555         this_arg_conv.is_owned = false;
56556         InitFeatures_set_wumbo_required(&this_arg_conv);
56557 }
56558
56559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56560         LDKInitFeatures this_arg_conv;
56561         this_arg_conv.inner = untag_ptr(this_arg);
56562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56564         this_arg_conv.is_owned = false;
56565         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
56566         return ret_conv;
56567 }
56568
56569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56570         LDKNodeFeatures this_arg_conv;
56571         this_arg_conv.inner = untag_ptr(this_arg);
56572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56574         this_arg_conv.is_owned = false;
56575         NodeFeatures_set_wumbo_optional(&this_arg_conv);
56576 }
56577
56578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56579         LDKNodeFeatures this_arg_conv;
56580         this_arg_conv.inner = untag_ptr(this_arg);
56581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56583         this_arg_conv.is_owned = false;
56584         NodeFeatures_set_wumbo_required(&this_arg_conv);
56585 }
56586
56587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56588         LDKNodeFeatures this_arg_conv;
56589         this_arg_conv.inner = untag_ptr(this_arg);
56590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56592         this_arg_conv.is_owned = false;
56593         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
56594         return ret_conv;
56595 }
56596
56597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56598         LDKInitFeatures this_arg_conv;
56599         this_arg_conv.inner = untag_ptr(this_arg);
56600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56602         this_arg_conv.is_owned = false;
56603         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
56604         return ret_conv;
56605 }
56606
56607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56608         LDKNodeFeatures this_arg_conv;
56609         this_arg_conv.inner = untag_ptr(this_arg);
56610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56612         this_arg_conv.is_owned = false;
56613         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
56614         return ret_conv;
56615 }
56616
56617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56618         LDKInitFeatures this_arg_conv;
56619         this_arg_conv.inner = untag_ptr(this_arg);
56620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56622         this_arg_conv.is_owned = false;
56623         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
56624 }
56625
56626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56627         LDKInitFeatures this_arg_conv;
56628         this_arg_conv.inner = untag_ptr(this_arg);
56629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56631         this_arg_conv.is_owned = false;
56632         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
56633 }
56634
56635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56636         LDKInitFeatures this_arg_conv;
56637         this_arg_conv.inner = untag_ptr(this_arg);
56638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56640         this_arg_conv.is_owned = false;
56641         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56642         return ret_conv;
56643 }
56644
56645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56646         LDKNodeFeatures this_arg_conv;
56647         this_arg_conv.inner = untag_ptr(this_arg);
56648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56650         this_arg_conv.is_owned = false;
56651         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
56652 }
56653
56654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56655         LDKNodeFeatures this_arg_conv;
56656         this_arg_conv.inner = untag_ptr(this_arg);
56657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56659         this_arg_conv.is_owned = false;
56660         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
56661 }
56662
56663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56664         LDKNodeFeatures this_arg_conv;
56665         this_arg_conv.inner = untag_ptr(this_arg);
56666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56668         this_arg_conv.is_owned = false;
56669         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56670         return ret_conv;
56671 }
56672
56673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56674         LDKChannelTypeFeatures this_arg_conv;
56675         this_arg_conv.inner = untag_ptr(this_arg);
56676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56678         this_arg_conv.is_owned = false;
56679         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
56680 }
56681
56682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56683         LDKChannelTypeFeatures this_arg_conv;
56684         this_arg_conv.inner = untag_ptr(this_arg);
56685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56687         this_arg_conv.is_owned = false;
56688         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
56689 }
56690
56691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56692         LDKChannelTypeFeatures this_arg_conv;
56693         this_arg_conv.inner = untag_ptr(this_arg);
56694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56696         this_arg_conv.is_owned = false;
56697         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56698         return ret_conv;
56699 }
56700
56701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56702         LDKInitFeatures this_arg_conv;
56703         this_arg_conv.inner = untag_ptr(this_arg);
56704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56706         this_arg_conv.is_owned = false;
56707         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56708         return ret_conv;
56709 }
56710
56711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56712         LDKNodeFeatures this_arg_conv;
56713         this_arg_conv.inner = untag_ptr(this_arg);
56714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56716         this_arg_conv.is_owned = false;
56717         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56718         return ret_conv;
56719 }
56720
56721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56722         LDKChannelTypeFeatures this_arg_conv;
56723         this_arg_conv.inner = untag_ptr(this_arg);
56724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56726         this_arg_conv.is_owned = false;
56727         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56728         return ret_conv;
56729 }
56730
56731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56732         LDKInitFeatures this_arg_conv;
56733         this_arg_conv.inner = untag_ptr(this_arg);
56734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56736         this_arg_conv.is_owned = false;
56737         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
56738 }
56739
56740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56741         LDKInitFeatures this_arg_conv;
56742         this_arg_conv.inner = untag_ptr(this_arg);
56743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56745         this_arg_conv.is_owned = false;
56746         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
56747 }
56748
56749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56750         LDKInitFeatures this_arg_conv;
56751         this_arg_conv.inner = untag_ptr(this_arg);
56752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56754         this_arg_conv.is_owned = false;
56755         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
56756         return ret_conv;
56757 }
56758
56759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56760         LDKNodeFeatures this_arg_conv;
56761         this_arg_conv.inner = untag_ptr(this_arg);
56762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56764         this_arg_conv.is_owned = false;
56765         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
56766 }
56767
56768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56769         LDKNodeFeatures this_arg_conv;
56770         this_arg_conv.inner = untag_ptr(this_arg);
56771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56773         this_arg_conv.is_owned = false;
56774         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
56775 }
56776
56777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56778         LDKNodeFeatures this_arg_conv;
56779         this_arg_conv.inner = untag_ptr(this_arg);
56780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56782         this_arg_conv.is_owned = false;
56783         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
56784         return ret_conv;
56785 }
56786
56787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56788         LDKChannelTypeFeatures this_arg_conv;
56789         this_arg_conv.inner = untag_ptr(this_arg);
56790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56792         this_arg_conv.is_owned = false;
56793         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
56794 }
56795
56796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56797         LDKChannelTypeFeatures this_arg_conv;
56798         this_arg_conv.inner = untag_ptr(this_arg);
56799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56801         this_arg_conv.is_owned = false;
56802         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
56803 }
56804
56805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56806         LDKChannelTypeFeatures this_arg_conv;
56807         this_arg_conv.inner = untag_ptr(this_arg);
56808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56810         this_arg_conv.is_owned = false;
56811         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
56812         return ret_conv;
56813 }
56814
56815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56816         LDKInitFeatures this_arg_conv;
56817         this_arg_conv.inner = untag_ptr(this_arg);
56818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56820         this_arg_conv.is_owned = false;
56821         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
56822         return ret_conv;
56823 }
56824
56825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56826         LDKNodeFeatures this_arg_conv;
56827         this_arg_conv.inner = untag_ptr(this_arg);
56828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56830         this_arg_conv.is_owned = false;
56831         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
56832         return ret_conv;
56833 }
56834
56835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56836         LDKChannelTypeFeatures this_arg_conv;
56837         this_arg_conv.inner = untag_ptr(this_arg);
56838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56840         this_arg_conv.is_owned = false;
56841         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
56842         return ret_conv;
56843 }
56844
56845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56846         LDKInitFeatures this_arg_conv;
56847         this_arg_conv.inner = untag_ptr(this_arg);
56848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56850         this_arg_conv.is_owned = false;
56851         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
56852 }
56853
56854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56855         LDKInitFeatures this_arg_conv;
56856         this_arg_conv.inner = untag_ptr(this_arg);
56857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56859         this_arg_conv.is_owned = false;
56860         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
56861 }
56862
56863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56864         LDKInitFeatures this_arg_conv;
56865         this_arg_conv.inner = untag_ptr(this_arg);
56866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56868         this_arg_conv.is_owned = false;
56869         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
56870         return ret_conv;
56871 }
56872
56873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56874         LDKNodeFeatures this_arg_conv;
56875         this_arg_conv.inner = untag_ptr(this_arg);
56876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56878         this_arg_conv.is_owned = false;
56879         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
56880 }
56881
56882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56883         LDKNodeFeatures this_arg_conv;
56884         this_arg_conv.inner = untag_ptr(this_arg);
56885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56887         this_arg_conv.is_owned = false;
56888         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
56889 }
56890
56891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56892         LDKNodeFeatures this_arg_conv;
56893         this_arg_conv.inner = untag_ptr(this_arg);
56894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56896         this_arg_conv.is_owned = false;
56897         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
56898         return ret_conv;
56899 }
56900
56901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56902         LDKInitFeatures this_arg_conv;
56903         this_arg_conv.inner = untag_ptr(this_arg);
56904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56906         this_arg_conv.is_owned = false;
56907         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
56908         return ret_conv;
56909 }
56910
56911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56912         LDKNodeFeatures this_arg_conv;
56913         this_arg_conv.inner = untag_ptr(this_arg);
56914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56916         this_arg_conv.is_owned = false;
56917         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
56918         return ret_conv;
56919 }
56920
56921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56922         LDKInitFeatures this_arg_conv;
56923         this_arg_conv.inner = untag_ptr(this_arg);
56924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56926         this_arg_conv.is_owned = false;
56927         InitFeatures_set_taproot_optional(&this_arg_conv);
56928 }
56929
56930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56931         LDKInitFeatures this_arg_conv;
56932         this_arg_conv.inner = untag_ptr(this_arg);
56933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56935         this_arg_conv.is_owned = false;
56936         InitFeatures_set_taproot_required(&this_arg_conv);
56937 }
56938
56939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
56940         LDKInitFeatures this_arg_conv;
56941         this_arg_conv.inner = untag_ptr(this_arg);
56942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56944         this_arg_conv.is_owned = false;
56945         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
56946         return ret_conv;
56947 }
56948
56949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56950         LDKNodeFeatures this_arg_conv;
56951         this_arg_conv.inner = untag_ptr(this_arg);
56952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56954         this_arg_conv.is_owned = false;
56955         NodeFeatures_set_taproot_optional(&this_arg_conv);
56956 }
56957
56958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56959         LDKNodeFeatures this_arg_conv;
56960         this_arg_conv.inner = untag_ptr(this_arg);
56961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56963         this_arg_conv.is_owned = false;
56964         NodeFeatures_set_taproot_required(&this_arg_conv);
56965 }
56966
56967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
56968         LDKNodeFeatures this_arg_conv;
56969         this_arg_conv.inner = untag_ptr(this_arg);
56970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56972         this_arg_conv.is_owned = false;
56973         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
56974         return ret_conv;
56975 }
56976
56977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56978         LDKChannelTypeFeatures this_arg_conv;
56979         this_arg_conv.inner = untag_ptr(this_arg);
56980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56982         this_arg_conv.is_owned = false;
56983         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
56984 }
56985
56986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56987         LDKChannelTypeFeatures this_arg_conv;
56988         this_arg_conv.inner = untag_ptr(this_arg);
56989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56991         this_arg_conv.is_owned = false;
56992         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
56993 }
56994
56995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
56996         LDKChannelTypeFeatures this_arg_conv;
56997         this_arg_conv.inner = untag_ptr(this_arg);
56998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57000         this_arg_conv.is_owned = false;
57001         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
57002         return ret_conv;
57003 }
57004
57005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57006         LDKInitFeatures this_arg_conv;
57007         this_arg_conv.inner = untag_ptr(this_arg);
57008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57010         this_arg_conv.is_owned = false;
57011         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
57012         return ret_conv;
57013 }
57014
57015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57016         LDKNodeFeatures this_arg_conv;
57017         this_arg_conv.inner = untag_ptr(this_arg);
57018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57020         this_arg_conv.is_owned = false;
57021         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
57022         return ret_conv;
57023 }
57024
57025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57026         LDKChannelTypeFeatures this_arg_conv;
57027         this_arg_conv.inner = untag_ptr(this_arg);
57028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57030         this_arg_conv.is_owned = false;
57031         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
57032         return ret_conv;
57033 }
57034
57035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57036         LDKInitFeatures this_arg_conv;
57037         this_arg_conv.inner = untag_ptr(this_arg);
57038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57040         this_arg_conv.is_owned = false;
57041         InitFeatures_set_onion_messages_optional(&this_arg_conv);
57042 }
57043
57044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57045         LDKInitFeatures this_arg_conv;
57046         this_arg_conv.inner = untag_ptr(this_arg);
57047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57049         this_arg_conv.is_owned = false;
57050         InitFeatures_set_onion_messages_required(&this_arg_conv);
57051 }
57052
57053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57054         LDKInitFeatures this_arg_conv;
57055         this_arg_conv.inner = untag_ptr(this_arg);
57056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57058         this_arg_conv.is_owned = false;
57059         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
57060         return ret_conv;
57061 }
57062
57063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57064         LDKNodeFeatures this_arg_conv;
57065         this_arg_conv.inner = untag_ptr(this_arg);
57066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57068         this_arg_conv.is_owned = false;
57069         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
57070 }
57071
57072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57073         LDKNodeFeatures this_arg_conv;
57074         this_arg_conv.inner = untag_ptr(this_arg);
57075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57077         this_arg_conv.is_owned = false;
57078         NodeFeatures_set_onion_messages_required(&this_arg_conv);
57079 }
57080
57081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57082         LDKNodeFeatures this_arg_conv;
57083         this_arg_conv.inner = untag_ptr(this_arg);
57084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57086         this_arg_conv.is_owned = false;
57087         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
57088         return ret_conv;
57089 }
57090
57091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57092         LDKInitFeatures this_arg_conv;
57093         this_arg_conv.inner = untag_ptr(this_arg);
57094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57096         this_arg_conv.is_owned = false;
57097         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
57098         return ret_conv;
57099 }
57100
57101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57102         LDKNodeFeatures this_arg_conv;
57103         this_arg_conv.inner = untag_ptr(this_arg);
57104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57106         this_arg_conv.is_owned = false;
57107         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
57108         return ret_conv;
57109 }
57110
57111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57112         LDKInitFeatures this_arg_conv;
57113         this_arg_conv.inner = untag_ptr(this_arg);
57114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57116         this_arg_conv.is_owned = false;
57117         InitFeatures_set_channel_type_optional(&this_arg_conv);
57118 }
57119
57120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57121         LDKInitFeatures this_arg_conv;
57122         this_arg_conv.inner = untag_ptr(this_arg);
57123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57125         this_arg_conv.is_owned = false;
57126         InitFeatures_set_channel_type_required(&this_arg_conv);
57127 }
57128
57129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57130         LDKInitFeatures this_arg_conv;
57131         this_arg_conv.inner = untag_ptr(this_arg);
57132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57134         this_arg_conv.is_owned = false;
57135         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
57136         return ret_conv;
57137 }
57138
57139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57140         LDKNodeFeatures this_arg_conv;
57141         this_arg_conv.inner = untag_ptr(this_arg);
57142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57144         this_arg_conv.is_owned = false;
57145         NodeFeatures_set_channel_type_optional(&this_arg_conv);
57146 }
57147
57148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57149         LDKNodeFeatures this_arg_conv;
57150         this_arg_conv.inner = untag_ptr(this_arg);
57151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57153         this_arg_conv.is_owned = false;
57154         NodeFeatures_set_channel_type_required(&this_arg_conv);
57155 }
57156
57157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57158         LDKNodeFeatures this_arg_conv;
57159         this_arg_conv.inner = untag_ptr(this_arg);
57160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57162         this_arg_conv.is_owned = false;
57163         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
57164         return ret_conv;
57165 }
57166
57167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57168         LDKInitFeatures this_arg_conv;
57169         this_arg_conv.inner = untag_ptr(this_arg);
57170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57172         this_arg_conv.is_owned = false;
57173         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
57174         return ret_conv;
57175 }
57176
57177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57178         LDKNodeFeatures this_arg_conv;
57179         this_arg_conv.inner = untag_ptr(this_arg);
57180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57182         this_arg_conv.is_owned = false;
57183         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
57184         return ret_conv;
57185 }
57186
57187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57188         LDKInitFeatures this_arg_conv;
57189         this_arg_conv.inner = untag_ptr(this_arg);
57190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57192         this_arg_conv.is_owned = false;
57193         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
57194 }
57195
57196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57197         LDKInitFeatures this_arg_conv;
57198         this_arg_conv.inner = untag_ptr(this_arg);
57199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57201         this_arg_conv.is_owned = false;
57202         InitFeatures_set_scid_privacy_required(&this_arg_conv);
57203 }
57204
57205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57206         LDKInitFeatures this_arg_conv;
57207         this_arg_conv.inner = untag_ptr(this_arg);
57208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57210         this_arg_conv.is_owned = false;
57211         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
57212         return ret_conv;
57213 }
57214
57215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57216         LDKNodeFeatures this_arg_conv;
57217         this_arg_conv.inner = untag_ptr(this_arg);
57218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57220         this_arg_conv.is_owned = false;
57221         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
57222 }
57223
57224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57225         LDKNodeFeatures this_arg_conv;
57226         this_arg_conv.inner = untag_ptr(this_arg);
57227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57229         this_arg_conv.is_owned = false;
57230         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
57231 }
57232
57233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57234         LDKNodeFeatures this_arg_conv;
57235         this_arg_conv.inner = untag_ptr(this_arg);
57236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57238         this_arg_conv.is_owned = false;
57239         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
57240         return ret_conv;
57241 }
57242
57243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57244         LDKChannelTypeFeatures this_arg_conv;
57245         this_arg_conv.inner = untag_ptr(this_arg);
57246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57248         this_arg_conv.is_owned = false;
57249         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
57250 }
57251
57252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57253         LDKChannelTypeFeatures this_arg_conv;
57254         this_arg_conv.inner = untag_ptr(this_arg);
57255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57257         this_arg_conv.is_owned = false;
57258         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
57259 }
57260
57261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57262         LDKChannelTypeFeatures this_arg_conv;
57263         this_arg_conv.inner = untag_ptr(this_arg);
57264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57266         this_arg_conv.is_owned = false;
57267         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
57268         return ret_conv;
57269 }
57270
57271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57272         LDKInitFeatures this_arg_conv;
57273         this_arg_conv.inner = untag_ptr(this_arg);
57274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57276         this_arg_conv.is_owned = false;
57277         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
57278         return ret_conv;
57279 }
57280
57281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57282         LDKNodeFeatures this_arg_conv;
57283         this_arg_conv.inner = untag_ptr(this_arg);
57284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57286         this_arg_conv.is_owned = false;
57287         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
57288         return ret_conv;
57289 }
57290
57291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57292         LDKChannelTypeFeatures this_arg_conv;
57293         this_arg_conv.inner = untag_ptr(this_arg);
57294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57296         this_arg_conv.is_owned = false;
57297         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
57298         return ret_conv;
57299 }
57300
57301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57302         LDKBolt11InvoiceFeatures this_arg_conv;
57303         this_arg_conv.inner = untag_ptr(this_arg);
57304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57306         this_arg_conv.is_owned = false;
57307         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
57308 }
57309
57310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57311         LDKBolt11InvoiceFeatures this_arg_conv;
57312         this_arg_conv.inner = untag_ptr(this_arg);
57313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57315         this_arg_conv.is_owned = false;
57316         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
57317 }
57318
57319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57320         LDKBolt11InvoiceFeatures this_arg_conv;
57321         this_arg_conv.inner = untag_ptr(this_arg);
57322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57324         this_arg_conv.is_owned = false;
57325         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
57326         return ret_conv;
57327 }
57328
57329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57330         LDKBolt11InvoiceFeatures this_arg_conv;
57331         this_arg_conv.inner = untag_ptr(this_arg);
57332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57334         this_arg_conv.is_owned = false;
57335         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
57336         return ret_conv;
57337 }
57338
57339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57340         LDKInitFeatures this_arg_conv;
57341         this_arg_conv.inner = untag_ptr(this_arg);
57342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57344         this_arg_conv.is_owned = false;
57345         InitFeatures_set_zero_conf_optional(&this_arg_conv);
57346 }
57347
57348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57349         LDKInitFeatures this_arg_conv;
57350         this_arg_conv.inner = untag_ptr(this_arg);
57351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57353         this_arg_conv.is_owned = false;
57354         InitFeatures_set_zero_conf_required(&this_arg_conv);
57355 }
57356
57357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57358         LDKInitFeatures this_arg_conv;
57359         this_arg_conv.inner = untag_ptr(this_arg);
57360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57362         this_arg_conv.is_owned = false;
57363         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
57364         return ret_conv;
57365 }
57366
57367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57368         LDKNodeFeatures this_arg_conv;
57369         this_arg_conv.inner = untag_ptr(this_arg);
57370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57372         this_arg_conv.is_owned = false;
57373         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
57374 }
57375
57376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57377         LDKNodeFeatures this_arg_conv;
57378         this_arg_conv.inner = untag_ptr(this_arg);
57379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57381         this_arg_conv.is_owned = false;
57382         NodeFeatures_set_zero_conf_required(&this_arg_conv);
57383 }
57384
57385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57386         LDKNodeFeatures this_arg_conv;
57387         this_arg_conv.inner = untag_ptr(this_arg);
57388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57390         this_arg_conv.is_owned = false;
57391         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
57392         return ret_conv;
57393 }
57394
57395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57396         LDKChannelTypeFeatures this_arg_conv;
57397         this_arg_conv.inner = untag_ptr(this_arg);
57398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57400         this_arg_conv.is_owned = false;
57401         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
57402 }
57403
57404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57405         LDKChannelTypeFeatures this_arg_conv;
57406         this_arg_conv.inner = untag_ptr(this_arg);
57407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57409         this_arg_conv.is_owned = false;
57410         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
57411 }
57412
57413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57414         LDKChannelTypeFeatures this_arg_conv;
57415         this_arg_conv.inner = untag_ptr(this_arg);
57416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57418         this_arg_conv.is_owned = false;
57419         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
57420         return ret_conv;
57421 }
57422
57423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57424         LDKInitFeatures this_arg_conv;
57425         this_arg_conv.inner = untag_ptr(this_arg);
57426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57428         this_arg_conv.is_owned = false;
57429         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
57430         return ret_conv;
57431 }
57432
57433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57434         LDKNodeFeatures this_arg_conv;
57435         this_arg_conv.inner = untag_ptr(this_arg);
57436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57438         this_arg_conv.is_owned = false;
57439         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
57440         return ret_conv;
57441 }
57442
57443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57444         LDKChannelTypeFeatures this_arg_conv;
57445         this_arg_conv.inner = untag_ptr(this_arg);
57446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57448         this_arg_conv.is_owned = false;
57449         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
57450         return ret_conv;
57451 }
57452
57453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57454         LDKNodeFeatures this_arg_conv;
57455         this_arg_conv.inner = untag_ptr(this_arg);
57456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57458         this_arg_conv.is_owned = false;
57459         NodeFeatures_set_keysend_optional(&this_arg_conv);
57460 }
57461
57462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57463         LDKNodeFeatures this_arg_conv;
57464         this_arg_conv.inner = untag_ptr(this_arg);
57465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57467         this_arg_conv.is_owned = false;
57468         NodeFeatures_set_keysend_required(&this_arg_conv);
57469 }
57470
57471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
57472         LDKNodeFeatures this_arg_conv;
57473         this_arg_conv.inner = untag_ptr(this_arg);
57474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57476         this_arg_conv.is_owned = false;
57477         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
57478         return ret_conv;
57479 }
57480
57481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
57482         LDKNodeFeatures this_arg_conv;
57483         this_arg_conv.inner = untag_ptr(this_arg);
57484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57486         this_arg_conv.is_owned = false;
57487         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
57488         return ret_conv;
57489 }
57490
57491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57492         LDKShutdownScript this_obj_conv;
57493         this_obj_conv.inner = untag_ptr(this_obj);
57494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57496         ShutdownScript_free(this_obj_conv);
57497 }
57498
57499 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
57500         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
57501         int64_t ret_ref = 0;
57502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57504         return ret_ref;
57505 }
57506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57507         LDKShutdownScript arg_conv;
57508         arg_conv.inner = untag_ptr(arg);
57509         arg_conv.is_owned = ptr_is_owned(arg);
57510         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57511         arg_conv.is_owned = false;
57512         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
57513         return ret_conv;
57514 }
57515
57516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57517         LDKShutdownScript orig_conv;
57518         orig_conv.inner = untag_ptr(orig);
57519         orig_conv.is_owned = ptr_is_owned(orig);
57520         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57521         orig_conv.is_owned = false;
57522         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
57523         int64_t ret_ref = 0;
57524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57526         return ret_ref;
57527 }
57528
57529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57530         LDKShutdownScript a_conv;
57531         a_conv.inner = untag_ptr(a);
57532         a_conv.is_owned = ptr_is_owned(a);
57533         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57534         a_conv.is_owned = false;
57535         LDKShutdownScript b_conv;
57536         b_conv.inner = untag_ptr(b);
57537         b_conv.is_owned = ptr_is_owned(b);
57538         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57539         b_conv.is_owned = false;
57540         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
57541         return ret_conv;
57542 }
57543
57544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57545         LDKInvalidShutdownScript this_obj_conv;
57546         this_obj_conv.inner = untag_ptr(this_obj);
57547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57549         InvalidShutdownScript_free(this_obj_conv);
57550 }
57551
57552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
57553         LDKInvalidShutdownScript this_ptr_conv;
57554         this_ptr_conv.inner = untag_ptr(this_ptr);
57555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57557         this_ptr_conv.is_owned = false;
57558         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
57559         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57560         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57561         return ret_arr;
57562 }
57563
57564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57565         LDKInvalidShutdownScript this_ptr_conv;
57566         this_ptr_conv.inner = untag_ptr(this_ptr);
57567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57569         this_ptr_conv.is_owned = false;
57570         LDKCVec_u8Z val_ref;
57571         val_ref.datalen = (*env)->GetArrayLength(env, val);
57572         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
57573         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
57574         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
57575 }
57576
57577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
57578         LDKCVec_u8Z script_arg_ref;
57579         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
57580         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
57581         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
57582         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
57583         int64_t ret_ref = 0;
57584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57586         return ret_ref;
57587 }
57588
57589 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
57590         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
57591         int64_t ret_ref = 0;
57592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57594         return ret_ref;
57595 }
57596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57597         LDKInvalidShutdownScript arg_conv;
57598         arg_conv.inner = untag_ptr(arg);
57599         arg_conv.is_owned = ptr_is_owned(arg);
57600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57601         arg_conv.is_owned = false;
57602         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
57603         return ret_conv;
57604 }
57605
57606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57607         LDKInvalidShutdownScript orig_conv;
57608         orig_conv.inner = untag_ptr(orig);
57609         orig_conv.is_owned = ptr_is_owned(orig);
57610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57611         orig_conv.is_owned = false;
57612         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
57613         int64_t ret_ref = 0;
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57616         return ret_ref;
57617 }
57618
57619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
57620         LDKShutdownScript obj_conv;
57621         obj_conv.inner = untag_ptr(obj);
57622         obj_conv.is_owned = ptr_is_owned(obj);
57623         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57624         obj_conv.is_owned = false;
57625         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
57626         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57627         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57628         CVec_u8Z_free(ret_var);
57629         return ret_arr;
57630 }
57631
57632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57633         LDKu8slice ser_ref;
57634         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57635         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57636         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
57637         *ret_conv = ShutdownScript_read(ser_ref);
57638         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57639         return tag_ptr(ret_conv, true);
57640 }
57641
57642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
57643         uint8_t pubkey_hash_arr[20];
57644         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
57645         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
57646         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
57647         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
57648         int64_t ret_ref = 0;
57649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57651         return ret_ref;
57652 }
57653
57654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
57655         uint8_t script_hash_arr[32];
57656         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
57657         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
57658         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
57659         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
57660         int64_t ret_ref = 0;
57661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57663         return ret_ref;
57664 }
57665
57666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
57667         
57668         LDKu8slice program_ref;
57669         program_ref.datalen = (*env)->GetArrayLength(env, program);
57670         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
57671         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
57672         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
57673         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
57674         return tag_ptr(ret_conv, true);
57675 }
57676
57677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
57678         LDKShutdownScript this_arg_conv;
57679         this_arg_conv.inner = untag_ptr(this_arg);
57680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57682         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
57683         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
57684         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57685         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57686         CVec_u8Z_free(ret_var);
57687         return ret_arr;
57688 }
57689
57690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
57691         LDKShutdownScript this_arg_conv;
57692         this_arg_conv.inner = untag_ptr(this_arg);
57693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57695         this_arg_conv.is_owned = false;
57696         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
57697         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
57698         return ret_arr;
57699 }
57700
57701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
57702         LDKShutdownScript this_arg_conv;
57703         this_arg_conv.inner = untag_ptr(this_arg);
57704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57706         this_arg_conv.is_owned = false;
57707         LDKInitFeatures features_conv;
57708         features_conv.inner = untag_ptr(features);
57709         features_conv.is_owned = ptr_is_owned(features);
57710         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
57711         features_conv.is_owned = false;
57712         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
57713         return ret_conv;
57714 }
57715
57716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57717         if (!ptr_is_owned(this_ptr)) return;
57718         void* this_ptr_ptr = untag_ptr(this_ptr);
57719         CHECK_ACCESS(this_ptr_ptr);
57720         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
57721         FREE(untag_ptr(this_ptr));
57722         Retry_free(this_ptr_conv);
57723 }
57724
57725 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
57726         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57727         *ret_copy = Retry_clone(arg);
57728         int64_t ret_ref = tag_ptr(ret_copy, true);
57729         return ret_ref;
57730 }
57731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57732         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
57733         int64_t ret_conv = Retry_clone_ptr(arg_conv);
57734         return ret_conv;
57735 }
57736
57737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57738         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
57739         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57740         *ret_copy = Retry_clone(orig_conv);
57741         int64_t ret_ref = tag_ptr(ret_copy, true);
57742         return ret_ref;
57743 }
57744
57745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
57746         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57747         *ret_copy = Retry_attempts(a);
57748         int64_t ret_ref = tag_ptr(ret_copy, true);
57749         return ret_ref;
57750 }
57751
57752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
57753         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57754         *ret_copy = Retry_timeout(a);
57755         int64_t ret_ref = tag_ptr(ret_copy, true);
57756         return ret_ref;
57757 }
57758
57759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57760         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
57761         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
57762         jboolean ret_conv = Retry_eq(a_conv, b_conv);
57763         return ret_conv;
57764 }
57765
57766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
57767         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
57768         int64_t ret_conv = Retry_hash(o_conv);
57769         return ret_conv;
57770 }
57771
57772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
57773         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
57774         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
57775         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57776         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57777         CVec_u8Z_free(ret_var);
57778         return ret_arr;
57779 }
57780
57781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57782         LDKu8slice ser_ref;
57783         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57784         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57785         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
57786         *ret_conv = Retry_read(ser_ref);
57787         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57788         return tag_ptr(ret_conv, true);
57789 }
57790
57791 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57792         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
57793         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
57794         return ret_conv;
57795 }
57796
57797 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
57798         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
57799         return ret_conv;
57800 }
57801
57802 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
57803         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
57804         return ret_conv;
57805 }
57806
57807 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
57808         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
57809         return ret_conv;
57810 }
57811
57812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57813         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
57814         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
57815         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
57816         return ret_conv;
57817 }
57818
57819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57820         if (!ptr_is_owned(this_ptr)) return;
57821         void* this_ptr_ptr = untag_ptr(this_ptr);
57822         CHECK_ACCESS(this_ptr_ptr);
57823         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
57824         FREE(untag_ptr(this_ptr));
57825         PaymentSendFailure_free(this_ptr_conv);
57826 }
57827
57828 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
57829         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57830         *ret_copy = PaymentSendFailure_clone(arg);
57831         int64_t ret_ref = tag_ptr(ret_copy, true);
57832         return ret_ref;
57833 }
57834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57835         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
57836         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
57837         return ret_conv;
57838 }
57839
57840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57841         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
57842         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57843         *ret_copy = PaymentSendFailure_clone(orig_conv);
57844         int64_t ret_ref = tag_ptr(ret_copy, true);
57845         return ret_ref;
57846 }
57847
57848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
57849         void* a_ptr = untag_ptr(a);
57850         CHECK_ACCESS(a_ptr);
57851         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
57852         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
57853         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57854         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
57855         int64_t ret_ref = tag_ptr(ret_copy, true);
57856         return ret_ref;
57857 }
57858
57859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
57860         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
57861         a_constr.datalen = (*env)->GetArrayLength(env, a);
57862         if (a_constr.datalen > 0)
57863                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
57864         else
57865                 a_constr.data = NULL;
57866         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
57867         for (size_t w = 0; w < a_constr.datalen; w++) {
57868                 int64_t a_conv_22 = a_vals[w];
57869                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
57870                 CHECK_ACCESS(a_conv_22_ptr);
57871                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
57872                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
57873                 a_constr.data[w] = a_conv_22_conv;
57874         }
57875         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
57876         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57877         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
57878         int64_t ret_ref = tag_ptr(ret_copy, true);
57879         return ret_ref;
57880 }
57881
57882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
57883         LDKCVec_APIErrorZ a_constr;
57884         a_constr.datalen = (*env)->GetArrayLength(env, a);
57885         if (a_constr.datalen > 0)
57886                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
57887         else
57888                 a_constr.data = NULL;
57889         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
57890         for (size_t k = 0; k < a_constr.datalen; k++) {
57891                 int64_t a_conv_10 = a_vals[k];
57892                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
57893                 CHECK_ACCESS(a_conv_10_ptr);
57894                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
57895                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
57896                 a_constr.data[k] = a_conv_10_conv;
57897         }
57898         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
57899         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57900         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
57901         int64_t ret_ref = tag_ptr(ret_copy, true);
57902         return ret_ref;
57903 }
57904
57905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
57906         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57907         *ret_copy = PaymentSendFailure_duplicate_payment();
57908         int64_t ret_ref = tag_ptr(ret_copy, true);
57909         return ret_ref;
57910 }
57911
57912 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) {
57913         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
57914         results_constr.datalen = (*env)->GetArrayLength(env, results);
57915         if (results_constr.datalen > 0)
57916                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
57917         else
57918                 results_constr.data = NULL;
57919         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
57920         for (size_t w = 0; w < results_constr.datalen; w++) {
57921                 int64_t results_conv_22 = results_vals[w];
57922                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
57923                 CHECK_ACCESS(results_conv_22_ptr);
57924                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
57925                 results_constr.data[w] = results_conv_22_conv;
57926         }
57927         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
57928         LDKRouteParameters failed_paths_retry_conv;
57929         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
57930         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
57931         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
57932         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
57933         LDKThirtyTwoBytes payment_id_ref;
57934         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
57935         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
57936         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57937         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
57938         int64_t ret_ref = tag_ptr(ret_copy, true);
57939         return ret_ref;
57940 }
57941
57942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57943         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
57944         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
57945         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
57946         return ret_conv;
57947 }
57948
57949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57950         if (!ptr_is_owned(this_ptr)) return;
57951         void* this_ptr_ptr = untag_ptr(this_ptr);
57952         CHECK_ACCESS(this_ptr_ptr);
57953         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
57954         FREE(untag_ptr(this_ptr));
57955         ProbeSendFailure_free(this_ptr_conv);
57956 }
57957
57958 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
57959         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57960         *ret_copy = ProbeSendFailure_clone(arg);
57961         int64_t ret_ref = tag_ptr(ret_copy, true);
57962         return ret_ref;
57963 }
57964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57965         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
57966         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
57967         return ret_conv;
57968 }
57969
57970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57971         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
57972         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57973         *ret_copy = ProbeSendFailure_clone(orig_conv);
57974         int64_t ret_ref = tag_ptr(ret_copy, true);
57975         return ret_ref;
57976 }
57977
57978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
57979         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57980         *ret_copy = ProbeSendFailure_route_not_found();
57981         int64_t ret_ref = tag_ptr(ret_copy, true);
57982         return ret_ref;
57983 }
57984
57985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
57986         void* a_ptr = untag_ptr(a);
57987         CHECK_ACCESS(a_ptr);
57988         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
57989         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
57990         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57991         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
57992         int64_t ret_ref = tag_ptr(ret_copy, true);
57993         return ret_ref;
57994 }
57995
57996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57997         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
57998         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
57999         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
58000         return ret_conv;
58001 }
58002
58003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58004         LDKRecipientOnionFields this_obj_conv;
58005         this_obj_conv.inner = untag_ptr(this_obj);
58006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58008         RecipientOnionFields_free(this_obj_conv);
58009 }
58010
58011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
58012         LDKRecipientOnionFields this_ptr_conv;
58013         this_ptr_conv.inner = untag_ptr(this_ptr);
58014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58016         this_ptr_conv.is_owned = false;
58017         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58018         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
58019         int64_t ret_ref = tag_ptr(ret_copy, true);
58020         return ret_ref;
58021 }
58022
58023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58024         LDKRecipientOnionFields this_ptr_conv;
58025         this_ptr_conv.inner = untag_ptr(this_ptr);
58026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58028         this_ptr_conv.is_owned = false;
58029         void* val_ptr = untag_ptr(val);
58030         CHECK_ACCESS(val_ptr);
58031         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58032         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58033         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
58034 }
58035
58036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
58037         LDKRecipientOnionFields this_ptr_conv;
58038         this_ptr_conv.inner = untag_ptr(this_ptr);
58039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58041         this_ptr_conv.is_owned = false;
58042         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58043         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
58044         int64_t ret_ref = tag_ptr(ret_copy, true);
58045         return ret_ref;
58046 }
58047
58048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58049         LDKRecipientOnionFields this_ptr_conv;
58050         this_ptr_conv.inner = untag_ptr(this_ptr);
58051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58053         this_ptr_conv.is_owned = false;
58054         void* val_ptr = untag_ptr(val);
58055         CHECK_ACCESS(val_ptr);
58056         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
58057         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
58058         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
58059 }
58060
58061 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
58062         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
58063         int64_t ret_ref = 0;
58064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58066         return ret_ref;
58067 }
58068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58069         LDKRecipientOnionFields arg_conv;
58070         arg_conv.inner = untag_ptr(arg);
58071         arg_conv.is_owned = ptr_is_owned(arg);
58072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58073         arg_conv.is_owned = false;
58074         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
58075         return ret_conv;
58076 }
58077
58078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58079         LDKRecipientOnionFields orig_conv;
58080         orig_conv.inner = untag_ptr(orig);
58081         orig_conv.is_owned = ptr_is_owned(orig);
58082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58083         orig_conv.is_owned = false;
58084         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
58085         int64_t ret_ref = 0;
58086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58088         return ret_ref;
58089 }
58090
58091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58092         LDKRecipientOnionFields a_conv;
58093         a_conv.inner = untag_ptr(a);
58094         a_conv.is_owned = ptr_is_owned(a);
58095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58096         a_conv.is_owned = false;
58097         LDKRecipientOnionFields b_conv;
58098         b_conv.inner = untag_ptr(b);
58099         b_conv.is_owned = ptr_is_owned(b);
58100         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58101         b_conv.is_owned = false;
58102         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
58103         return ret_conv;
58104 }
58105
58106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
58107         LDKRecipientOnionFields obj_conv;
58108         obj_conv.inner = untag_ptr(obj);
58109         obj_conv.is_owned = ptr_is_owned(obj);
58110         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58111         obj_conv.is_owned = false;
58112         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
58113         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58114         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58115         CVec_u8Z_free(ret_var);
58116         return ret_arr;
58117 }
58118
58119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58120         LDKu8slice ser_ref;
58121         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58122         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58123         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
58124         *ret_conv = RecipientOnionFields_read(ser_ref);
58125         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58126         return tag_ptr(ret_conv, true);
58127 }
58128
58129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
58130         LDKThirtyTwoBytes payment_secret_ref;
58131         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
58132         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
58133         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
58134         int64_t ret_ref = 0;
58135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58137         return ret_ref;
58138 }
58139
58140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
58141         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
58142         int64_t ret_ref = 0;
58143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58145         return ret_ref;
58146 }
58147
58148 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) {
58149         LDKRecipientOnionFields this_arg_conv;
58150         this_arg_conv.inner = untag_ptr(this_arg);
58151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58153         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
58154         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
58155         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
58156         if (custom_tlvs_constr.datalen > 0)
58157                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
58158         else
58159                 custom_tlvs_constr.data = NULL;
58160         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
58161         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
58162                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
58163                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
58164                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
58165                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
58166                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
58167                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
58168         }
58169         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
58170         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
58171         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
58172         return tag_ptr(ret_conv, true);
58173 }
58174
58175 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
58176         LDKRecipientOnionFields this_arg_conv;
58177         this_arg_conv.inner = untag_ptr(this_arg);
58178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58180         this_arg_conv.is_owned = false;
58181         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
58182         int64_tArray ret_arr = NULL;
58183         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58184         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58185         for (size_t x = 0; x < ret_var.datalen; x++) {
58186                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
58187                 *ret_conv_23_conv = ret_var.data[x];
58188                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
58189         }
58190         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58191         FREE(ret_var.data);
58192         return ret_arr;
58193 }
58194
58195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58196         if (!ptr_is_owned(this_ptr)) return;
58197         void* this_ptr_ptr = untag_ptr(this_ptr);
58198         CHECK_ACCESS(this_ptr_ptr);
58199         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
58200         FREE(untag_ptr(this_ptr));
58201         CustomMessageReader_free(this_ptr_conv);
58202 }
58203
58204 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
58205         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58206         *ret_ret = Type_clone(arg);
58207         return tag_ptr(ret_ret, true);
58208 }
58209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58210         void* arg_ptr = untag_ptr(arg);
58211         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58212         LDKType* arg_conv = (LDKType*)arg_ptr;
58213         int64_t ret_conv = Type_clone_ptr(arg_conv);
58214         return ret_conv;
58215 }
58216
58217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58218         void* orig_ptr = untag_ptr(orig);
58219         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58220         LDKType* orig_conv = (LDKType*)orig_ptr;
58221         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58222         *ret_ret = Type_clone(orig_conv);
58223         return tag_ptr(ret_ret, true);
58224 }
58225
58226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58227         if (!ptr_is_owned(this_ptr)) return;
58228         void* this_ptr_ptr = untag_ptr(this_ptr);
58229         CHECK_ACCESS(this_ptr_ptr);
58230         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
58231         FREE(untag_ptr(this_ptr));
58232         Type_free(this_ptr_conv);
58233 }
58234
58235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58236         LDKOffer this_obj_conv;
58237         this_obj_conv.inner = untag_ptr(this_obj);
58238         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58240         Offer_free(this_obj_conv);
58241 }
58242
58243 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
58244         LDKOffer ret_var = Offer_clone(arg);
58245         int64_t ret_ref = 0;
58246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58248         return ret_ref;
58249 }
58250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58251         LDKOffer arg_conv;
58252         arg_conv.inner = untag_ptr(arg);
58253         arg_conv.is_owned = ptr_is_owned(arg);
58254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58255         arg_conv.is_owned = false;
58256         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
58257         return ret_conv;
58258 }
58259
58260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58261         LDKOffer orig_conv;
58262         orig_conv.inner = untag_ptr(orig);
58263         orig_conv.is_owned = ptr_is_owned(orig);
58264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58265         orig_conv.is_owned = false;
58266         LDKOffer ret_var = Offer_clone(&orig_conv);
58267         int64_t ret_ref = 0;
58268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58270         return ret_ref;
58271 }
58272
58273 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58274         LDKOffer this_arg_conv;
58275         this_arg_conv.inner = untag_ptr(this_arg);
58276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58278         this_arg_conv.is_owned = false;
58279         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
58280         jobjectArray ret_arr = NULL;
58281         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
58282         ;
58283         for (size_t i = 0; i < ret_var.datalen; i++) {
58284                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
58285                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
58286                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
58287         }
58288         
58289         FREE(ret_var.data);
58290         return ret_arr;
58291 }
58292
58293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58294         LDKOffer this_arg_conv;
58295         this_arg_conv.inner = untag_ptr(this_arg);
58296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58298         this_arg_conv.is_owned = false;
58299         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58300         *ret_copy = Offer_metadata(&this_arg_conv);
58301         int64_t ret_ref = tag_ptr(ret_copy, true);
58302         return ret_ref;
58303 }
58304
58305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58306         LDKOffer this_arg_conv;
58307         this_arg_conv.inner = untag_ptr(this_arg);
58308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58310         this_arg_conv.is_owned = false;
58311         LDKAmount ret_var = Offer_amount(&this_arg_conv);
58312         int64_t ret_ref = 0;
58313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58315         return ret_ref;
58316 }
58317
58318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58319         LDKOffer this_arg_conv;
58320         this_arg_conv.inner = untag_ptr(this_arg);
58321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58323         this_arg_conv.is_owned = false;
58324         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
58325         int64_t ret_ref = 0;
58326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58328         return ret_ref;
58329 }
58330
58331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58332         LDKOffer this_arg_conv;
58333         this_arg_conv.inner = untag_ptr(this_arg);
58334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58336         this_arg_conv.is_owned = false;
58337         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
58338         int64_t ret_ref = 0;
58339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58341         return ret_ref;
58342 }
58343
58344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58345         LDKOffer this_arg_conv;
58346         this_arg_conv.inner = untag_ptr(this_arg);
58347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58349         this_arg_conv.is_owned = false;
58350         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58351         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
58352         int64_t ret_ref = tag_ptr(ret_copy, true);
58353         return ret_ref;
58354 }
58355
58356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58357         LDKOffer this_arg_conv;
58358         this_arg_conv.inner = untag_ptr(this_arg);
58359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58361         this_arg_conv.is_owned = false;
58362         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
58363         int64_t ret_ref = 0;
58364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58366         return ret_ref;
58367 }
58368
58369 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
58370         LDKOffer this_arg_conv;
58371         this_arg_conv.inner = untag_ptr(this_arg);
58372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58374         this_arg_conv.is_owned = false;
58375         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
58376         int64_tArray ret_arr = NULL;
58377         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58378         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58379         for (size_t n = 0; n < ret_var.datalen; n++) {
58380                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
58381                 int64_t ret_conv_13_ref = 0;
58382                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
58383                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
58384                 ret_arr_ptr[n] = ret_conv_13_ref;
58385         }
58386         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58387         FREE(ret_var.data);
58388         return ret_arr;
58389 }
58390
58391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58392         LDKOffer this_arg_conv;
58393         this_arg_conv.inner = untag_ptr(this_arg);
58394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58396         this_arg_conv.is_owned = false;
58397         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
58398         int64_t ret_ref = 0;
58399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58401         return ret_ref;
58402 }
58403
58404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
58405         LDKOffer this_arg_conv;
58406         this_arg_conv.inner = untag_ptr(this_arg);
58407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58409         this_arg_conv.is_owned = false;
58410         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58411         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
58412         return ret_arr;
58413 }
58414
58415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
58416         LDKOffer this_arg_conv;
58417         this_arg_conv.inner = untag_ptr(this_arg);
58418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58420         this_arg_conv.is_owned = false;
58421         LDKThirtyTwoBytes chain_ref;
58422         CHECK((*env)->GetArrayLength(env, chain) == 32);
58423         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
58424         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
58425         return ret_conv;
58426 }
58427
58428 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
58429         LDKOffer this_arg_conv;
58430         this_arg_conv.inner = untag_ptr(this_arg);
58431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58433         this_arg_conv.is_owned = false;
58434         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
58435         return ret_conv;
58436 }
58437
58438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
58439         LDKOffer this_arg_conv;
58440         this_arg_conv.inner = untag_ptr(this_arg);
58441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58443         this_arg_conv.is_owned = false;
58444         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
58445         return ret_conv;
58446 }
58447
58448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58449         LDKOffer this_arg_conv;
58450         this_arg_conv.inner = untag_ptr(this_arg);
58451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58453         this_arg_conv.is_owned = false;
58454         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
58455         return ret_conv;
58456 }
58457
58458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
58459         LDKOffer obj_conv;
58460         obj_conv.inner = untag_ptr(obj);
58461         obj_conv.is_owned = ptr_is_owned(obj);
58462         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58463         obj_conv.is_owned = false;
58464         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
58465         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58466         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58467         CVec_u8Z_free(ret_var);
58468         return ret_arr;
58469 }
58470
58471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58472         LDKAmount this_obj_conv;
58473         this_obj_conv.inner = untag_ptr(this_obj);
58474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58476         Amount_free(this_obj_conv);
58477 }
58478
58479 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
58480         LDKAmount ret_var = Amount_clone(arg);
58481         int64_t ret_ref = 0;
58482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58484         return ret_ref;
58485 }
58486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58487         LDKAmount arg_conv;
58488         arg_conv.inner = untag_ptr(arg);
58489         arg_conv.is_owned = ptr_is_owned(arg);
58490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58491         arg_conv.is_owned = false;
58492         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
58493         return ret_conv;
58494 }
58495
58496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58497         LDKAmount orig_conv;
58498         orig_conv.inner = untag_ptr(orig);
58499         orig_conv.is_owned = ptr_is_owned(orig);
58500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58501         orig_conv.is_owned = false;
58502         LDKAmount ret_var = Amount_clone(&orig_conv);
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
58509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58510         LDKQuantity this_obj_conv;
58511         this_obj_conv.inner = untag_ptr(this_obj);
58512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58514         Quantity_free(this_obj_conv);
58515 }
58516
58517 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
58518         LDKQuantity ret_var = Quantity_clone(arg);
58519         int64_t ret_ref = 0;
58520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58522         return ret_ref;
58523 }
58524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58525         LDKQuantity arg_conv;
58526         arg_conv.inner = untag_ptr(arg);
58527         arg_conv.is_owned = ptr_is_owned(arg);
58528         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58529         arg_conv.is_owned = false;
58530         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
58531         return ret_conv;
58532 }
58533
58534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58535         LDKQuantity orig_conv;
58536         orig_conv.inner = untag_ptr(orig);
58537         orig_conv.is_owned = ptr_is_owned(orig);
58538         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58539         orig_conv.is_owned = false;
58540         LDKQuantity ret_var = Quantity_clone(&orig_conv);
58541         int64_t ret_ref = 0;
58542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58544         return ret_ref;
58545 }
58546
58547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
58548         LDKStr s_conv = java_to_owned_str(env, s);
58549         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
58550         *ret_conv = Offer_from_str(s_conv);
58551         return tag_ptr(ret_conv, true);
58552 }
58553
58554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58555         LDKUnsignedBolt12Invoice 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         UnsignedBolt12Invoice_free(this_obj_conv);
58560 }
58561
58562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
58563         LDKUnsignedBolt12Invoice this_arg_conv;
58564         this_arg_conv.inner = untag_ptr(this_arg);
58565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58567         this_arg_conv.is_owned = false;
58568         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
58569         int64_t ret_ref = 0;
58570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58572         return ret_ref;
58573 }
58574
58575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58576         LDKBolt12Invoice this_obj_conv;
58577         this_obj_conv.inner = untag_ptr(this_obj);
58578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58580         Bolt12Invoice_free(this_obj_conv);
58581 }
58582
58583 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
58584         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
58585         int64_t ret_ref = 0;
58586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58588         return ret_ref;
58589 }
58590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58591         LDKBolt12Invoice arg_conv;
58592         arg_conv.inner = untag_ptr(arg);
58593         arg_conv.is_owned = ptr_is_owned(arg);
58594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58595         arg_conv.is_owned = false;
58596         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
58597         return ret_conv;
58598 }
58599
58600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58601         LDKBolt12Invoice orig_conv;
58602         orig_conv.inner = untag_ptr(orig);
58603         orig_conv.is_owned = ptr_is_owned(orig);
58604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58605         orig_conv.is_owned = false;
58606         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
58607         int64_t ret_ref = 0;
58608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58610         return ret_ref;
58611 }
58612
58613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58614         LDKUnsignedBolt12Invoice this_arg_conv;
58615         this_arg_conv.inner = untag_ptr(this_arg);
58616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58618         this_arg_conv.is_owned = false;
58619         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
58620         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
58621         int64_t ret_ref = tag_ptr(ret_copy, true);
58622         return ret_ref;
58623 }
58624
58625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
58626         LDKUnsignedBolt12Invoice this_arg_conv;
58627         this_arg_conv.inner = untag_ptr(this_arg);
58628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58630         this_arg_conv.is_owned = false;
58631         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
58633         return ret_arr;
58634 }
58635
58636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58637         LDKUnsignedBolt12Invoice this_arg_conv;
58638         this_arg_conv.inner = untag_ptr(this_arg);
58639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58641         this_arg_conv.is_owned = false;
58642         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58643         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
58644         int64_t ret_ref = tag_ptr(ret_copy, true);
58645         return ret_ref;
58646 }
58647
58648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58649         LDKUnsignedBolt12Invoice this_arg_conv;
58650         this_arg_conv.inner = untag_ptr(this_arg);
58651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58653         this_arg_conv.is_owned = false;
58654         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
58655         int64_t ret_ref = 0;
58656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58658         return ret_ref;
58659 }
58660
58661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58662         LDKUnsignedBolt12Invoice this_arg_conv;
58663         this_arg_conv.inner = untag_ptr(this_arg);
58664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58666         this_arg_conv.is_owned = false;
58667         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
58668         int64_t ret_ref = 0;
58669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58671         return ret_ref;
58672 }
58673
58674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58675         LDKUnsignedBolt12Invoice this_arg_conv;
58676         this_arg_conv.inner = untag_ptr(this_arg);
58677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58679         this_arg_conv.is_owned = false;
58680         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
58681         int64_t ret_ref = 0;
58682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58684         return ret_ref;
58685 }
58686
58687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58688         LDKUnsignedBolt12Invoice this_arg_conv;
58689         this_arg_conv.inner = untag_ptr(this_arg);
58690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58692         this_arg_conv.is_owned = false;
58693         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58694         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
58695         int64_t ret_ref = tag_ptr(ret_copy, true);
58696         return ret_ref;
58697 }
58698
58699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58700         LDKUnsignedBolt12Invoice this_arg_conv;
58701         this_arg_conv.inner = untag_ptr(this_arg);
58702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58704         this_arg_conv.is_owned = false;
58705         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
58706         int64_t ret_ref = 0;
58707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58709         return ret_ref;
58710 }
58711
58712 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
58713         LDKUnsignedBolt12Invoice this_arg_conv;
58714         this_arg_conv.inner = untag_ptr(this_arg);
58715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58717         this_arg_conv.is_owned = false;
58718         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
58719         int64_tArray ret_arr = NULL;
58720         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58721         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58722         for (size_t n = 0; n < ret_var.datalen; n++) {
58723                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
58724                 int64_t ret_conv_13_ref = 0;
58725                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
58726                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
58727                 ret_arr_ptr[n] = ret_conv_13_ref;
58728         }
58729         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58730         FREE(ret_var.data);
58731         return ret_arr;
58732 }
58733
58734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58735         LDKUnsignedBolt12Invoice this_arg_conv;
58736         this_arg_conv.inner = untag_ptr(this_arg);
58737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58739         this_arg_conv.is_owned = false;
58740         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
58741         int64_t ret_ref = 0;
58742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58744         return ret_ref;
58745 }
58746
58747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58748         LDKUnsignedBolt12Invoice this_arg_conv;
58749         this_arg_conv.inner = untag_ptr(this_arg);
58750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58752         this_arg_conv.is_owned = false;
58753         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
58754         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58755         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58756         return ret_arr;
58757 }
58758
58759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58760         LDKUnsignedBolt12Invoice this_arg_conv;
58761         this_arg_conv.inner = untag_ptr(this_arg);
58762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58764         this_arg_conv.is_owned = false;
58765         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
58766         int64_t ret_ref = 0;
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58769         return ret_ref;
58770 }
58771
58772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58773         LDKUnsignedBolt12Invoice this_arg_conv;
58774         this_arg_conv.inner = untag_ptr(this_arg);
58775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58777         this_arg_conv.is_owned = false;
58778         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58779         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
58780         int64_t ret_ref = tag_ptr(ret_copy, true);
58781         return ret_ref;
58782 }
58783
58784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
58785         LDKUnsignedBolt12Invoice this_arg_conv;
58786         this_arg_conv.inner = untag_ptr(this_arg);
58787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58789         this_arg_conv.is_owned = false;
58790         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58791         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
58792         return ret_arr;
58793 }
58794
58795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
58796         LDKUnsignedBolt12Invoice this_arg_conv;
58797         this_arg_conv.inner = untag_ptr(this_arg);
58798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58800         this_arg_conv.is_owned = false;
58801         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
58802         int64_t ret_ref = 0;
58803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58805         return ret_ref;
58806 }
58807
58808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
58809         LDKUnsignedBolt12Invoice this_arg_conv;
58810         this_arg_conv.inner = untag_ptr(this_arg);
58811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58813         this_arg_conv.is_owned = false;
58814         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
58815         return ret_conv;
58816 }
58817
58818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58819         LDKUnsignedBolt12Invoice this_arg_conv;
58820         this_arg_conv.inner = untag_ptr(this_arg);
58821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58823         this_arg_conv.is_owned = false;
58824         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
58825         return ret_conv;
58826 }
58827
58828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
58829         LDKUnsignedBolt12Invoice this_arg_conv;
58830         this_arg_conv.inner = untag_ptr(this_arg);
58831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58833         this_arg_conv.is_owned = false;
58834         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
58835         return ret_conv;
58836 }
58837
58838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
58839         LDKUnsignedBolt12Invoice this_arg_conv;
58840         this_arg_conv.inner = untag_ptr(this_arg);
58841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58843         this_arg_conv.is_owned = false;
58844         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58845         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
58846         return ret_arr;
58847 }
58848
58849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
58850         LDKUnsignedBolt12Invoice this_arg_conv;
58851         this_arg_conv.inner = untag_ptr(this_arg);
58852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58854         this_arg_conv.is_owned = false;
58855         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
58856         return ret_conv;
58857 }
58858
58859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58860         LDKUnsignedBolt12Invoice this_arg_conv;
58861         this_arg_conv.inner = untag_ptr(this_arg);
58862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58864         this_arg_conv.is_owned = false;
58865         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
58866         int64_t ret_ref = 0;
58867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58869         return ret_ref;
58870 }
58871
58872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
58873         LDKUnsignedBolt12Invoice this_arg_conv;
58874         this_arg_conv.inner = untag_ptr(this_arg);
58875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58877         this_arg_conv.is_owned = false;
58878         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
58880         return ret_arr;
58881 }
58882
58883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58884         LDKBolt12Invoice this_arg_conv;
58885         this_arg_conv.inner = untag_ptr(this_arg);
58886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58888         this_arg_conv.is_owned = false;
58889         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
58890         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
58891         int64_t ret_ref = tag_ptr(ret_copy, true);
58892         return ret_ref;
58893 }
58894
58895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
58896         LDKBolt12Invoice this_arg_conv;
58897         this_arg_conv.inner = untag_ptr(this_arg);
58898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58900         this_arg_conv.is_owned = false;
58901         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58902         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
58903         return ret_arr;
58904 }
58905
58906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58907         LDKBolt12Invoice this_arg_conv;
58908         this_arg_conv.inner = untag_ptr(this_arg);
58909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58911         this_arg_conv.is_owned = false;
58912         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58913         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
58914         int64_t ret_ref = tag_ptr(ret_copy, true);
58915         return ret_ref;
58916 }
58917
58918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58919         LDKBolt12Invoice this_arg_conv;
58920         this_arg_conv.inner = untag_ptr(this_arg);
58921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58923         this_arg_conv.is_owned = false;
58924         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
58925         int64_t ret_ref = 0;
58926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58928         return ret_ref;
58929 }
58930
58931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58932         LDKBolt12Invoice this_arg_conv;
58933         this_arg_conv.inner = untag_ptr(this_arg);
58934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58936         this_arg_conv.is_owned = false;
58937         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
58938         int64_t ret_ref = 0;
58939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58941         return ret_ref;
58942 }
58943
58944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58945         LDKBolt12Invoice this_arg_conv;
58946         this_arg_conv.inner = untag_ptr(this_arg);
58947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58949         this_arg_conv.is_owned = false;
58950         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
58951         int64_t ret_ref = 0;
58952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58954         return ret_ref;
58955 }
58956
58957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58958         LDKBolt12Invoice this_arg_conv;
58959         this_arg_conv.inner = untag_ptr(this_arg);
58960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58962         this_arg_conv.is_owned = false;
58963         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58964         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
58965         int64_t ret_ref = tag_ptr(ret_copy, true);
58966         return ret_ref;
58967 }
58968
58969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58970         LDKBolt12Invoice this_arg_conv;
58971         this_arg_conv.inner = untag_ptr(this_arg);
58972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58974         this_arg_conv.is_owned = false;
58975         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
58976         int64_t ret_ref = 0;
58977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58979         return ret_ref;
58980 }
58981
58982 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
58983         LDKBolt12Invoice this_arg_conv;
58984         this_arg_conv.inner = untag_ptr(this_arg);
58985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58987         this_arg_conv.is_owned = false;
58988         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
58989         int64_tArray ret_arr = NULL;
58990         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58991         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58992         for (size_t n = 0; n < ret_var.datalen; n++) {
58993                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
58994                 int64_t ret_conv_13_ref = 0;
58995                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
58996                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
58997                 ret_arr_ptr[n] = ret_conv_13_ref;
58998         }
58999         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59000         FREE(ret_var.data);
59001         return ret_arr;
59002 }
59003
59004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59005         LDKBolt12Invoice this_arg_conv;
59006         this_arg_conv.inner = untag_ptr(this_arg);
59007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59009         this_arg_conv.is_owned = false;
59010         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
59011         int64_t ret_ref = 0;
59012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59014         return ret_ref;
59015 }
59016
59017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59018         LDKBolt12Invoice this_arg_conv;
59019         this_arg_conv.inner = untag_ptr(this_arg);
59020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59022         this_arg_conv.is_owned = false;
59023         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
59024         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59025         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59026         return ret_arr;
59027 }
59028
59029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59030         LDKBolt12Invoice this_arg_conv;
59031         this_arg_conv.inner = untag_ptr(this_arg);
59032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59034         this_arg_conv.is_owned = false;
59035         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
59036         int64_t ret_ref = 0;
59037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59039         return ret_ref;
59040 }
59041
59042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59043         LDKBolt12Invoice this_arg_conv;
59044         this_arg_conv.inner = untag_ptr(this_arg);
59045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59047         this_arg_conv.is_owned = false;
59048         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59049         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
59050         int64_t ret_ref = tag_ptr(ret_copy, true);
59051         return ret_ref;
59052 }
59053
59054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59055         LDKBolt12Invoice this_arg_conv;
59056         this_arg_conv.inner = untag_ptr(this_arg);
59057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59059         this_arg_conv.is_owned = false;
59060         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59061         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
59062         return ret_arr;
59063 }
59064
59065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
59066         LDKBolt12Invoice this_arg_conv;
59067         this_arg_conv.inner = untag_ptr(this_arg);
59068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59070         this_arg_conv.is_owned = false;
59071         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
59072         int64_t ret_ref = 0;
59073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59075         return ret_ref;
59076 }
59077
59078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
59079         LDKBolt12Invoice this_arg_conv;
59080         this_arg_conv.inner = untag_ptr(this_arg);
59081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59083         this_arg_conv.is_owned = false;
59084         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
59085         return ret_conv;
59086 }
59087
59088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59089         LDKBolt12Invoice this_arg_conv;
59090         this_arg_conv.inner = untag_ptr(this_arg);
59091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59093         this_arg_conv.is_owned = false;
59094         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
59095         return ret_conv;
59096 }
59097
59098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59099         LDKBolt12Invoice this_arg_conv;
59100         this_arg_conv.inner = untag_ptr(this_arg);
59101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59103         this_arg_conv.is_owned = false;
59104         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
59105         return ret_conv;
59106 }
59107
59108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59109         LDKBolt12Invoice this_arg_conv;
59110         this_arg_conv.inner = untag_ptr(this_arg);
59111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59113         this_arg_conv.is_owned = false;
59114         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59115         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
59116         return ret_arr;
59117 }
59118
59119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59120         LDKBolt12Invoice this_arg_conv;
59121         this_arg_conv.inner = untag_ptr(this_arg);
59122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59124         this_arg_conv.is_owned = false;
59125         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
59126         return ret_conv;
59127 }
59128
59129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59130         LDKBolt12Invoice this_arg_conv;
59131         this_arg_conv.inner = untag_ptr(this_arg);
59132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59134         this_arg_conv.is_owned = false;
59135         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
59136         int64_t ret_ref = 0;
59137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59139         return ret_ref;
59140 }
59141
59142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59143         LDKBolt12Invoice this_arg_conv;
59144         this_arg_conv.inner = untag_ptr(this_arg);
59145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59147         this_arg_conv.is_owned = false;
59148         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59149         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
59150         return ret_arr;
59151 }
59152
59153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
59154         LDKBolt12Invoice this_arg_conv;
59155         this_arg_conv.inner = untag_ptr(this_arg);
59156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59158         this_arg_conv.is_owned = false;
59159         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59160         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
59161         return ret_arr;
59162 }
59163
59164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59165         LDKBolt12Invoice this_arg_conv;
59166         this_arg_conv.inner = untag_ptr(this_arg);
59167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59169         this_arg_conv.is_owned = false;
59170         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
59172         return ret_arr;
59173 }
59174
59175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
59176         LDKBolt12Invoice this_arg_conv;
59177         this_arg_conv.inner = untag_ptr(this_arg);
59178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59180         this_arg_conv.is_owned = false;
59181         LDKExpandedKey key_conv;
59182         key_conv.inner = untag_ptr(key);
59183         key_conv.is_owned = ptr_is_owned(key);
59184         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
59185         key_conv.is_owned = false;
59186         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
59187         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
59188         return tag_ptr(ret_conv, true);
59189 }
59190
59191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59192         LDKUnsignedBolt12Invoice obj_conv;
59193         obj_conv.inner = untag_ptr(obj);
59194         obj_conv.is_owned = ptr_is_owned(obj);
59195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59196         obj_conv.is_owned = false;
59197         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
59198         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59199         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59200         CVec_u8Z_free(ret_var);
59201         return ret_arr;
59202 }
59203
59204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59205         LDKBolt12Invoice obj_conv;
59206         obj_conv.inner = untag_ptr(obj);
59207         obj_conv.is_owned = ptr_is_owned(obj);
59208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59209         obj_conv.is_owned = false;
59210         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
59211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59213         CVec_u8Z_free(ret_var);
59214         return ret_arr;
59215 }
59216
59217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59218         LDKBlindedPayInfo this_obj_conv;
59219         this_obj_conv.inner = untag_ptr(this_obj);
59220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59222         BlindedPayInfo_free(this_obj_conv);
59223 }
59224
59225 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59226         LDKBlindedPayInfo this_ptr_conv;
59227         this_ptr_conv.inner = untag_ptr(this_ptr);
59228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59230         this_ptr_conv.is_owned = false;
59231         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
59232         return ret_conv;
59233 }
59234
59235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59236         LDKBlindedPayInfo this_ptr_conv;
59237         this_ptr_conv.inner = untag_ptr(this_ptr);
59238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59240         this_ptr_conv.is_owned = false;
59241         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
59242 }
59243
59244 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59245         LDKBlindedPayInfo this_ptr_conv;
59246         this_ptr_conv.inner = untag_ptr(this_ptr);
59247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59249         this_ptr_conv.is_owned = false;
59250         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
59251         return ret_conv;
59252 }
59253
59254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59255         LDKBlindedPayInfo this_ptr_conv;
59256         this_ptr_conv.inner = untag_ptr(this_ptr);
59257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59259         this_ptr_conv.is_owned = false;
59260         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
59261 }
59262
59263 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59264         LDKBlindedPayInfo this_ptr_conv;
59265         this_ptr_conv.inner = untag_ptr(this_ptr);
59266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59268         this_ptr_conv.is_owned = false;
59269         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
59270         return ret_conv;
59271 }
59272
59273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59274         LDKBlindedPayInfo this_ptr_conv;
59275         this_ptr_conv.inner = untag_ptr(this_ptr);
59276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59278         this_ptr_conv.is_owned = false;
59279         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
59280 }
59281
59282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59283         LDKBlindedPayInfo this_ptr_conv;
59284         this_ptr_conv.inner = untag_ptr(this_ptr);
59285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59287         this_ptr_conv.is_owned = false;
59288         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
59289         return ret_conv;
59290 }
59291
59292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59293         LDKBlindedPayInfo this_ptr_conv;
59294         this_ptr_conv.inner = untag_ptr(this_ptr);
59295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59297         this_ptr_conv.is_owned = false;
59298         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
59299 }
59300
59301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59302         LDKBlindedPayInfo this_ptr_conv;
59303         this_ptr_conv.inner = untag_ptr(this_ptr);
59304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59306         this_ptr_conv.is_owned = false;
59307         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
59308         return ret_conv;
59309 }
59310
59311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59312         LDKBlindedPayInfo this_ptr_conv;
59313         this_ptr_conv.inner = untag_ptr(this_ptr);
59314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59316         this_ptr_conv.is_owned = false;
59317         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
59318 }
59319
59320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59321         LDKBlindedPayInfo this_ptr_conv;
59322         this_ptr_conv.inner = untag_ptr(this_ptr);
59323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59325         this_ptr_conv.is_owned = false;
59326         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
59327         int64_t ret_ref = 0;
59328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59330         return ret_ref;
59331 }
59332
59333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59334         LDKBlindedPayInfo this_ptr_conv;
59335         this_ptr_conv.inner = untag_ptr(this_ptr);
59336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59338         this_ptr_conv.is_owned = false;
59339         LDKBlindedHopFeatures val_conv;
59340         val_conv.inner = untag_ptr(val);
59341         val_conv.is_owned = ptr_is_owned(val);
59342         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59343         val_conv = BlindedHopFeatures_clone(&val_conv);
59344         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
59345 }
59346
59347 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) {
59348         LDKBlindedHopFeatures features_arg_conv;
59349         features_arg_conv.inner = untag_ptr(features_arg);
59350         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59351         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59352         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
59353         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);
59354         int64_t ret_ref = 0;
59355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59357         return ret_ref;
59358 }
59359
59360 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
59361         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
59362         int64_t ret_ref = 0;
59363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59365         return ret_ref;
59366 }
59367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59368         LDKBlindedPayInfo arg_conv;
59369         arg_conv.inner = untag_ptr(arg);
59370         arg_conv.is_owned = ptr_is_owned(arg);
59371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59372         arg_conv.is_owned = false;
59373         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
59374         return ret_conv;
59375 }
59376
59377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59378         LDKBlindedPayInfo orig_conv;
59379         orig_conv.inner = untag_ptr(orig);
59380         orig_conv.is_owned = ptr_is_owned(orig);
59381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59382         orig_conv.is_owned = false;
59383         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
59384         int64_t ret_ref = 0;
59385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59387         return ret_ref;
59388 }
59389
59390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
59391         LDKBlindedPayInfo o_conv;
59392         o_conv.inner = untag_ptr(o);
59393         o_conv.is_owned = ptr_is_owned(o);
59394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59395         o_conv.is_owned = false;
59396         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
59397         return ret_conv;
59398 }
59399
59400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59401         LDKBlindedPayInfo a_conv;
59402         a_conv.inner = untag_ptr(a);
59403         a_conv.is_owned = ptr_is_owned(a);
59404         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59405         a_conv.is_owned = false;
59406         LDKBlindedPayInfo b_conv;
59407         b_conv.inner = untag_ptr(b);
59408         b_conv.is_owned = ptr_is_owned(b);
59409         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59410         b_conv.is_owned = false;
59411         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
59412         return ret_conv;
59413 }
59414
59415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
59416         LDKBlindedPayInfo obj_conv;
59417         obj_conv.inner = untag_ptr(obj);
59418         obj_conv.is_owned = ptr_is_owned(obj);
59419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59420         obj_conv.is_owned = false;
59421         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
59422         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59423         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59424         CVec_u8Z_free(ret_var);
59425         return ret_arr;
59426 }
59427
59428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59429         LDKu8slice ser_ref;
59430         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59431         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59432         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
59433         *ret_conv = BlindedPayInfo_read(ser_ref);
59434         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59435         return tag_ptr(ret_conv, true);
59436 }
59437
59438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59439         LDKInvoiceError this_obj_conv;
59440         this_obj_conv.inner = untag_ptr(this_obj);
59441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59443         InvoiceError_free(this_obj_conv);
59444 }
59445
59446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
59447         LDKInvoiceError this_ptr_conv;
59448         this_ptr_conv.inner = untag_ptr(this_ptr);
59449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59451         this_ptr_conv.is_owned = false;
59452         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
59453         int64_t ret_ref = 0;
59454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59456         return ret_ref;
59457 }
59458
59459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59460         LDKInvoiceError this_ptr_conv;
59461         this_ptr_conv.inner = untag_ptr(this_ptr);
59462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59464         this_ptr_conv.is_owned = false;
59465         LDKErroneousField val_conv;
59466         val_conv.inner = untag_ptr(val);
59467         val_conv.is_owned = ptr_is_owned(val);
59468         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59469         val_conv = ErroneousField_clone(&val_conv);
59470         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
59471 }
59472
59473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
59474         LDKInvoiceError this_ptr_conv;
59475         this_ptr_conv.inner = untag_ptr(this_ptr);
59476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59478         this_ptr_conv.is_owned = false;
59479         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
59480         int64_t ret_ref = 0;
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59483         return ret_ref;
59484 }
59485
59486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59487         LDKInvoiceError this_ptr_conv;
59488         this_ptr_conv.inner = untag_ptr(this_ptr);
59489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59491         this_ptr_conv.is_owned = false;
59492         LDKUntrustedString val_conv;
59493         val_conv.inner = untag_ptr(val);
59494         val_conv.is_owned = ptr_is_owned(val);
59495         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59496         val_conv = UntrustedString_clone(&val_conv);
59497         InvoiceError_set_message(&this_ptr_conv, val_conv);
59498 }
59499
59500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
59501         LDKErroneousField erroneous_field_arg_conv;
59502         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
59503         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
59504         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
59505         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
59506         LDKUntrustedString message_arg_conv;
59507         message_arg_conv.inner = untag_ptr(message_arg);
59508         message_arg_conv.is_owned = ptr_is_owned(message_arg);
59509         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
59510         message_arg_conv = UntrustedString_clone(&message_arg_conv);
59511         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
59512         int64_t ret_ref = 0;
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59515         return ret_ref;
59516 }
59517
59518 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
59519         LDKInvoiceError ret_var = InvoiceError_clone(arg);
59520         int64_t ret_ref = 0;
59521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59523         return ret_ref;
59524 }
59525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59526         LDKInvoiceError arg_conv;
59527         arg_conv.inner = untag_ptr(arg);
59528         arg_conv.is_owned = ptr_is_owned(arg);
59529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59530         arg_conv.is_owned = false;
59531         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
59532         return ret_conv;
59533 }
59534
59535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59536         LDKInvoiceError orig_conv;
59537         orig_conv.inner = untag_ptr(orig);
59538         orig_conv.is_owned = ptr_is_owned(orig);
59539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59540         orig_conv.is_owned = false;
59541         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
59542         int64_t ret_ref = 0;
59543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59545         return ret_ref;
59546 }
59547
59548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59549         LDKErroneousField this_obj_conv;
59550         this_obj_conv.inner = untag_ptr(this_obj);
59551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59553         ErroneousField_free(this_obj_conv);
59554 }
59555
59556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
59557         LDKErroneousField this_ptr_conv;
59558         this_ptr_conv.inner = untag_ptr(this_ptr);
59559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59561         this_ptr_conv.is_owned = false;
59562         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
59563         return ret_conv;
59564 }
59565
59566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59567         LDKErroneousField this_ptr_conv;
59568         this_ptr_conv.inner = untag_ptr(this_ptr);
59569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59571         this_ptr_conv.is_owned = false;
59572         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
59573 }
59574
59575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
59576         LDKErroneousField this_ptr_conv;
59577         this_ptr_conv.inner = untag_ptr(this_ptr);
59578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59580         this_ptr_conv.is_owned = false;
59581         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59582         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
59583         int64_t ret_ref = tag_ptr(ret_copy, true);
59584         return ret_ref;
59585 }
59586
59587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59588         LDKErroneousField this_ptr_conv;
59589         this_ptr_conv.inner = untag_ptr(this_ptr);
59590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59592         this_ptr_conv.is_owned = false;
59593         void* val_ptr = untag_ptr(val);
59594         CHECK_ACCESS(val_ptr);
59595         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
59596         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
59597         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
59598 }
59599
59600 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) {
59601         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
59602         CHECK_ACCESS(suggested_value_arg_ptr);
59603         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
59604         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
59605         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
59606         int64_t ret_ref = 0;
59607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59609         return ret_ref;
59610 }
59611
59612 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
59613         LDKErroneousField ret_var = ErroneousField_clone(arg);
59614         int64_t ret_ref = 0;
59615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59617         return ret_ref;
59618 }
59619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59620         LDKErroneousField arg_conv;
59621         arg_conv.inner = untag_ptr(arg);
59622         arg_conv.is_owned = ptr_is_owned(arg);
59623         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59624         arg_conv.is_owned = false;
59625         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
59626         return ret_conv;
59627 }
59628
59629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59630         LDKErroneousField orig_conv;
59631         orig_conv.inner = untag_ptr(orig);
59632         orig_conv.is_owned = ptr_is_owned(orig);
59633         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59634         orig_conv.is_owned = false;
59635         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
59636         int64_t ret_ref = 0;
59637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59639         return ret_ref;
59640 }
59641
59642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
59643         LDKInvoiceError obj_conv;
59644         obj_conv.inner = untag_ptr(obj);
59645         obj_conv.is_owned = ptr_is_owned(obj);
59646         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59647         obj_conv.is_owned = false;
59648         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
59649         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59650         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59651         CVec_u8Z_free(ret_var);
59652         return ret_arr;
59653 }
59654
59655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59656         LDKu8slice ser_ref;
59657         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59658         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59659         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
59660         *ret_conv = InvoiceError_read(ser_ref);
59661         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59662         return tag_ptr(ret_conv, true);
59663 }
59664
59665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59666         LDKUnsignedInvoiceRequest this_obj_conv;
59667         this_obj_conv.inner = untag_ptr(this_obj);
59668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59670         UnsignedInvoiceRequest_free(this_obj_conv);
59671 }
59672
59673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59674         LDKUnsignedInvoiceRequest this_arg_conv;
59675         this_arg_conv.inner = untag_ptr(this_arg);
59676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59678         this_arg_conv.is_owned = false;
59679         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
59680         int64_t ret_ref = 0;
59681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59683         return ret_ref;
59684 }
59685
59686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59687         LDKInvoiceRequest this_obj_conv;
59688         this_obj_conv.inner = untag_ptr(this_obj);
59689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59691         InvoiceRequest_free(this_obj_conv);
59692 }
59693
59694 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
59695         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
59696         int64_t ret_ref = 0;
59697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59699         return ret_ref;
59700 }
59701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59702         LDKInvoiceRequest arg_conv;
59703         arg_conv.inner = untag_ptr(arg);
59704         arg_conv.is_owned = ptr_is_owned(arg);
59705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59706         arg_conv.is_owned = false;
59707         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
59708         return ret_conv;
59709 }
59710
59711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59712         LDKInvoiceRequest orig_conv;
59713         orig_conv.inner = untag_ptr(orig);
59714         orig_conv.is_owned = ptr_is_owned(orig);
59715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59716         orig_conv.is_owned = false;
59717         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
59718         int64_t ret_ref = 0;
59719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59721         return ret_ref;
59722 }
59723
59724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59725         LDKVerifiedInvoiceRequest this_obj_conv;
59726         this_obj_conv.inner = untag_ptr(this_obj);
59727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59729         VerifiedInvoiceRequest_free(this_obj_conv);
59730 }
59731
59732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
59733         LDKVerifiedInvoiceRequest this_ptr_conv;
59734         this_ptr_conv.inner = untag_ptr(this_ptr);
59735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59737         this_ptr_conv.is_owned = false;
59738         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
59739         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
59740         int64_t ret_ref = tag_ptr(ret_copy, true);
59741         return ret_ref;
59742 }
59743
59744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59745         LDKVerifiedInvoiceRequest this_ptr_conv;
59746         this_ptr_conv.inner = untag_ptr(this_ptr);
59747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59749         this_ptr_conv.is_owned = false;
59750         void* val_ptr = untag_ptr(val);
59751         CHECK_ACCESS(val_ptr);
59752         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
59753         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
59754         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
59755 }
59756
59757 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
59758         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
59759         int64_t ret_ref = 0;
59760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59762         return ret_ref;
59763 }
59764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59765         LDKVerifiedInvoiceRequest arg_conv;
59766         arg_conv.inner = untag_ptr(arg);
59767         arg_conv.is_owned = ptr_is_owned(arg);
59768         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59769         arg_conv.is_owned = false;
59770         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
59771         return ret_conv;
59772 }
59773
59774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59775         LDKVerifiedInvoiceRequest orig_conv;
59776         orig_conv.inner = untag_ptr(orig);
59777         orig_conv.is_owned = ptr_is_owned(orig);
59778         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59779         orig_conv.is_owned = false;
59780         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
59781         int64_t ret_ref = 0;
59782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59784         return ret_ref;
59785 }
59786
59787 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
59788         LDKUnsignedInvoiceRequest this_arg_conv;
59789         this_arg_conv.inner = untag_ptr(this_arg);
59790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59792         this_arg_conv.is_owned = false;
59793         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
59794         jobjectArray ret_arr = NULL;
59795         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
59796         ;
59797         for (size_t i = 0; i < ret_var.datalen; i++) {
59798                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
59799                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
59800                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
59801         }
59802         
59803         FREE(ret_var.data);
59804         return ret_arr;
59805 }
59806
59807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59808         LDKUnsignedInvoiceRequest this_arg_conv;
59809         this_arg_conv.inner = untag_ptr(this_arg);
59810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59812         this_arg_conv.is_owned = false;
59813         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59814         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
59815         int64_t ret_ref = tag_ptr(ret_copy, true);
59816         return ret_ref;
59817 }
59818
59819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
59820         LDKUnsignedInvoiceRequest this_arg_conv;
59821         this_arg_conv.inner = untag_ptr(this_arg);
59822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59824         this_arg_conv.is_owned = false;
59825         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
59826         int64_t ret_ref = 0;
59827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59829         return ret_ref;
59830 }
59831
59832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
59833         LDKUnsignedInvoiceRequest this_arg_conv;
59834         this_arg_conv.inner = untag_ptr(this_arg);
59835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59837         this_arg_conv.is_owned = false;
59838         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
59839         int64_t ret_ref = 0;
59840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59842         return ret_ref;
59843 }
59844
59845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59846         LDKUnsignedInvoiceRequest this_arg_conv;
59847         this_arg_conv.inner = untag_ptr(this_arg);
59848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59850         this_arg_conv.is_owned = false;
59851         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
59852         int64_t ret_ref = 0;
59853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59855         return ret_ref;
59856 }
59857
59858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59859         LDKUnsignedInvoiceRequest this_arg_conv;
59860         this_arg_conv.inner = untag_ptr(this_arg);
59861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59863         this_arg_conv.is_owned = false;
59864         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59865         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
59866         int64_t ret_ref = tag_ptr(ret_copy, true);
59867         return ret_ref;
59868 }
59869
59870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59871         LDKUnsignedInvoiceRequest this_arg_conv;
59872         this_arg_conv.inner = untag_ptr(this_arg);
59873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59875         this_arg_conv.is_owned = false;
59876         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
59877         int64_t ret_ref = 0;
59878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59880         return ret_ref;
59881 }
59882
59883 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59884         LDKUnsignedInvoiceRequest this_arg_conv;
59885         this_arg_conv.inner = untag_ptr(this_arg);
59886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59888         this_arg_conv.is_owned = false;
59889         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
59890         int64_tArray ret_arr = NULL;
59891         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59892         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59893         for (size_t n = 0; n < ret_var.datalen; n++) {
59894                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59895                 int64_t ret_conv_13_ref = 0;
59896                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59897                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59898                 ret_arr_ptr[n] = ret_conv_13_ref;
59899         }
59900         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59901         FREE(ret_var.data);
59902         return ret_arr;
59903 }
59904
59905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59906         LDKUnsignedInvoiceRequest this_arg_conv;
59907         this_arg_conv.inner = untag_ptr(this_arg);
59908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59910         this_arg_conv.is_owned = false;
59911         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
59912         int64_t ret_ref = 0;
59913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59915         return ret_ref;
59916 }
59917
59918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59919         LDKUnsignedInvoiceRequest this_arg_conv;
59920         this_arg_conv.inner = untag_ptr(this_arg);
59921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59923         this_arg_conv.is_owned = false;
59924         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59925         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
59926         return ret_arr;
59927 }
59928
59929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59930         LDKUnsignedInvoiceRequest this_arg_conv;
59931         this_arg_conv.inner = untag_ptr(this_arg);
59932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59934         this_arg_conv.is_owned = false;
59935         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
59936         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59937         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59938         return ret_arr;
59939 }
59940
59941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
59942         LDKUnsignedInvoiceRequest this_arg_conv;
59943         this_arg_conv.inner = untag_ptr(this_arg);
59944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59946         this_arg_conv.is_owned = false;
59947         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59948         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
59949         return ret_arr;
59950 }
59951
59952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59953         LDKUnsignedInvoiceRequest this_arg_conv;
59954         this_arg_conv.inner = untag_ptr(this_arg);
59955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59957         this_arg_conv.is_owned = false;
59958         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59959         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
59960         int64_t ret_ref = tag_ptr(ret_copy, true);
59961         return ret_ref;
59962 }
59963
59964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59965         LDKUnsignedInvoiceRequest this_arg_conv;
59966         this_arg_conv.inner = untag_ptr(this_arg);
59967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59969         this_arg_conv.is_owned = false;
59970         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
59971         int64_t ret_ref = 0;
59972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59974         return ret_ref;
59975 }
59976
59977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59978         LDKUnsignedInvoiceRequest this_arg_conv;
59979         this_arg_conv.inner = untag_ptr(this_arg);
59980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59982         this_arg_conv.is_owned = false;
59983         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59984         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
59985         int64_t ret_ref = tag_ptr(ret_copy, true);
59986         return ret_ref;
59987 }
59988
59989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59990         LDKUnsignedInvoiceRequest this_arg_conv;
59991         this_arg_conv.inner = untag_ptr(this_arg);
59992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59994         this_arg_conv.is_owned = false;
59995         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59996         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
59997         return ret_arr;
59998 }
59999
60000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60001         LDKUnsignedInvoiceRequest this_arg_conv;
60002         this_arg_conv.inner = untag_ptr(this_arg);
60003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60005         this_arg_conv.is_owned = false;
60006         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
60007         int64_t ret_ref = 0;
60008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60010         return ret_ref;
60011 }
60012
60013 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60014         LDKInvoiceRequest this_arg_conv;
60015         this_arg_conv.inner = untag_ptr(this_arg);
60016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60018         this_arg_conv.is_owned = false;
60019         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
60020         jobjectArray ret_arr = NULL;
60021         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60022         ;
60023         for (size_t i = 0; i < ret_var.datalen; i++) {
60024                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60025                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60026                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60027         }
60028         
60029         FREE(ret_var.data);
60030         return ret_arr;
60031 }
60032
60033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60034         LDKInvoiceRequest this_arg_conv;
60035         this_arg_conv.inner = untag_ptr(this_arg);
60036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60038         this_arg_conv.is_owned = false;
60039         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60040         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
60041         int64_t ret_ref = tag_ptr(ret_copy, true);
60042         return ret_ref;
60043 }
60044
60045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60046         LDKInvoiceRequest this_arg_conv;
60047         this_arg_conv.inner = untag_ptr(this_arg);
60048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60050         this_arg_conv.is_owned = false;
60051         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
60052         int64_t ret_ref = 0;
60053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60055         return ret_ref;
60056 }
60057
60058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60059         LDKInvoiceRequest this_arg_conv;
60060         this_arg_conv.inner = untag_ptr(this_arg);
60061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60063         this_arg_conv.is_owned = false;
60064         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
60065         int64_t ret_ref = 0;
60066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60068         return ret_ref;
60069 }
60070
60071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60072         LDKInvoiceRequest this_arg_conv;
60073         this_arg_conv.inner = untag_ptr(this_arg);
60074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60076         this_arg_conv.is_owned = false;
60077         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
60078         int64_t ret_ref = 0;
60079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60081         return ret_ref;
60082 }
60083
60084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60085         LDKInvoiceRequest this_arg_conv;
60086         this_arg_conv.inner = untag_ptr(this_arg);
60087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60089         this_arg_conv.is_owned = false;
60090         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60091         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
60092         int64_t ret_ref = tag_ptr(ret_copy, true);
60093         return ret_ref;
60094 }
60095
60096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60097         LDKInvoiceRequest this_arg_conv;
60098         this_arg_conv.inner = untag_ptr(this_arg);
60099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60101         this_arg_conv.is_owned = false;
60102         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
60103         int64_t ret_ref = 0;
60104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60106         return ret_ref;
60107 }
60108
60109 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60110         LDKInvoiceRequest this_arg_conv;
60111         this_arg_conv.inner = untag_ptr(this_arg);
60112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60114         this_arg_conv.is_owned = false;
60115         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
60116         int64_tArray ret_arr = NULL;
60117         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60118         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60119         for (size_t n = 0; n < ret_var.datalen; n++) {
60120                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60121                 int64_t ret_conv_13_ref = 0;
60122                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60123                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60124                 ret_arr_ptr[n] = ret_conv_13_ref;
60125         }
60126         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60127         FREE(ret_var.data);
60128         return ret_arr;
60129 }
60130
60131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60132         LDKInvoiceRequest this_arg_conv;
60133         this_arg_conv.inner = untag_ptr(this_arg);
60134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60136         this_arg_conv.is_owned = false;
60137         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
60138         int64_t ret_ref = 0;
60139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60141         return ret_ref;
60142 }
60143
60144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60145         LDKInvoiceRequest this_arg_conv;
60146         this_arg_conv.inner = untag_ptr(this_arg);
60147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60149         this_arg_conv.is_owned = false;
60150         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60151         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60152         return ret_arr;
60153 }
60154
60155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60156         LDKInvoiceRequest this_arg_conv;
60157         this_arg_conv.inner = untag_ptr(this_arg);
60158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60160         this_arg_conv.is_owned = false;
60161         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
60162         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60163         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60164         return ret_arr;
60165 }
60166
60167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60168         LDKInvoiceRequest this_arg_conv;
60169         this_arg_conv.inner = untag_ptr(this_arg);
60170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60172         this_arg_conv.is_owned = false;
60173         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60174         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
60175         return ret_arr;
60176 }
60177
60178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60179         LDKInvoiceRequest this_arg_conv;
60180         this_arg_conv.inner = untag_ptr(this_arg);
60181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60183         this_arg_conv.is_owned = false;
60184         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60185         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
60186         int64_t ret_ref = tag_ptr(ret_copy, true);
60187         return ret_ref;
60188 }
60189
60190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60191         LDKInvoiceRequest this_arg_conv;
60192         this_arg_conv.inner = untag_ptr(this_arg);
60193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60195         this_arg_conv.is_owned = false;
60196         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
60197         int64_t ret_ref = 0;
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60200         return ret_ref;
60201 }
60202
60203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60204         LDKInvoiceRequest this_arg_conv;
60205         this_arg_conv.inner = untag_ptr(this_arg);
60206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60208         this_arg_conv.is_owned = false;
60209         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60210         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
60211         int64_t ret_ref = tag_ptr(ret_copy, true);
60212         return ret_ref;
60213 }
60214
60215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60216         LDKInvoiceRequest this_arg_conv;
60217         this_arg_conv.inner = untag_ptr(this_arg);
60218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60220         this_arg_conv.is_owned = false;
60221         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60222         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60223         return ret_arr;
60224 }
60225
60226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60227         LDKInvoiceRequest this_arg_conv;
60228         this_arg_conv.inner = untag_ptr(this_arg);
60229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60231         this_arg_conv.is_owned = false;
60232         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
60233         int64_t ret_ref = 0;
60234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60236         return ret_ref;
60237 }
60238
60239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
60240         LDKInvoiceRequest this_arg_conv;
60241         this_arg_conv.inner = untag_ptr(this_arg);
60242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60244         this_arg_conv.is_owned = false;
60245         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60246         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
60247         return ret_arr;
60248 }
60249
60250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
60251         LDKInvoiceRequest this_arg_conv;
60252         this_arg_conv.inner = untag_ptr(this_arg);
60253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60255         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
60256         LDKExpandedKey key_conv;
60257         key_conv.inner = untag_ptr(key);
60258         key_conv.is_owned = ptr_is_owned(key);
60259         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60260         key_conv.is_owned = false;
60261         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
60262         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
60263         return tag_ptr(ret_conv, true);
60264 }
60265
60266 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60267         LDKVerifiedInvoiceRequest this_arg_conv;
60268         this_arg_conv.inner = untag_ptr(this_arg);
60269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60271         this_arg_conv.is_owned = false;
60272         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
60273         jobjectArray ret_arr = NULL;
60274         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60275         ;
60276         for (size_t i = 0; i < ret_var.datalen; i++) {
60277                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60278                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60279                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60280         }
60281         
60282         FREE(ret_var.data);
60283         return ret_arr;
60284 }
60285
60286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60287         LDKVerifiedInvoiceRequest this_arg_conv;
60288         this_arg_conv.inner = untag_ptr(this_arg);
60289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60291         this_arg_conv.is_owned = false;
60292         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60293         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
60294         int64_t ret_ref = tag_ptr(ret_copy, true);
60295         return ret_ref;
60296 }
60297
60298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60299         LDKVerifiedInvoiceRequest this_arg_conv;
60300         this_arg_conv.inner = untag_ptr(this_arg);
60301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60303         this_arg_conv.is_owned = false;
60304         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
60305         int64_t ret_ref = 0;
60306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60308         return ret_ref;
60309 }
60310
60311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60312         LDKVerifiedInvoiceRequest this_arg_conv;
60313         this_arg_conv.inner = untag_ptr(this_arg);
60314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60316         this_arg_conv.is_owned = false;
60317         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
60318         int64_t ret_ref = 0;
60319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60321         return ret_ref;
60322 }
60323
60324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60325         LDKVerifiedInvoiceRequest this_arg_conv;
60326         this_arg_conv.inner = untag_ptr(this_arg);
60327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60329         this_arg_conv.is_owned = false;
60330         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
60331         int64_t ret_ref = 0;
60332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60334         return ret_ref;
60335 }
60336
60337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60338         LDKVerifiedInvoiceRequest this_arg_conv;
60339         this_arg_conv.inner = untag_ptr(this_arg);
60340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60342         this_arg_conv.is_owned = false;
60343         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60344         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
60345         int64_t ret_ref = tag_ptr(ret_copy, true);
60346         return ret_ref;
60347 }
60348
60349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60350         LDKVerifiedInvoiceRequest this_arg_conv;
60351         this_arg_conv.inner = untag_ptr(this_arg);
60352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60354         this_arg_conv.is_owned = false;
60355         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
60356         int64_t ret_ref = 0;
60357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60359         return ret_ref;
60360 }
60361
60362 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60363         LDKVerifiedInvoiceRequest this_arg_conv;
60364         this_arg_conv.inner = untag_ptr(this_arg);
60365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60367         this_arg_conv.is_owned = false;
60368         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
60369         int64_tArray ret_arr = NULL;
60370         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60371         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60372         for (size_t n = 0; n < ret_var.datalen; n++) {
60373                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60374                 int64_t ret_conv_13_ref = 0;
60375                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60376                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60377                 ret_arr_ptr[n] = ret_conv_13_ref;
60378         }
60379         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60380         FREE(ret_var.data);
60381         return ret_arr;
60382 }
60383
60384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60385         LDKVerifiedInvoiceRequest this_arg_conv;
60386         this_arg_conv.inner = untag_ptr(this_arg);
60387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60389         this_arg_conv.is_owned = false;
60390         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
60391         int64_t ret_ref = 0;
60392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60394         return ret_ref;
60395 }
60396
60397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60398         LDKVerifiedInvoiceRequest this_arg_conv;
60399         this_arg_conv.inner = untag_ptr(this_arg);
60400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60402         this_arg_conv.is_owned = false;
60403         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60404         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60405         return ret_arr;
60406 }
60407
60408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60409         LDKVerifiedInvoiceRequest this_arg_conv;
60410         this_arg_conv.inner = untag_ptr(this_arg);
60411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60413         this_arg_conv.is_owned = false;
60414         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
60415         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60416         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60417         return ret_arr;
60418 }
60419
60420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60421         LDKVerifiedInvoiceRequest this_arg_conv;
60422         this_arg_conv.inner = untag_ptr(this_arg);
60423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60425         this_arg_conv.is_owned = false;
60426         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60427         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
60428         return ret_arr;
60429 }
60430
60431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60432         LDKVerifiedInvoiceRequest this_arg_conv;
60433         this_arg_conv.inner = untag_ptr(this_arg);
60434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60436         this_arg_conv.is_owned = false;
60437         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60438         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
60439         int64_t ret_ref = tag_ptr(ret_copy, true);
60440         return ret_ref;
60441 }
60442
60443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60444         LDKVerifiedInvoiceRequest this_arg_conv;
60445         this_arg_conv.inner = untag_ptr(this_arg);
60446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60448         this_arg_conv.is_owned = false;
60449         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
60450         int64_t ret_ref = 0;
60451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60453         return ret_ref;
60454 }
60455
60456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60457         LDKVerifiedInvoiceRequest this_arg_conv;
60458         this_arg_conv.inner = untag_ptr(this_arg);
60459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60461         this_arg_conv.is_owned = false;
60462         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60463         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
60464         int64_t ret_ref = tag_ptr(ret_copy, true);
60465         return ret_ref;
60466 }
60467
60468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60469         LDKVerifiedInvoiceRequest this_arg_conv;
60470         this_arg_conv.inner = untag_ptr(this_arg);
60471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60473         this_arg_conv.is_owned = false;
60474         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60475         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60476         return ret_arr;
60477 }
60478
60479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60480         LDKVerifiedInvoiceRequest this_arg_conv;
60481         this_arg_conv.inner = untag_ptr(this_arg);
60482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60484         this_arg_conv.is_owned = false;
60485         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
60486         int64_t ret_ref = 0;
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60489         return ret_ref;
60490 }
60491
60492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
60493         LDKUnsignedInvoiceRequest obj_conv;
60494         obj_conv.inner = untag_ptr(obj);
60495         obj_conv.is_owned = ptr_is_owned(obj);
60496         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60497         obj_conv.is_owned = false;
60498         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
60499         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60500         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60501         CVec_u8Z_free(ret_var);
60502         return ret_arr;
60503 }
60504
60505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
60506         LDKInvoiceRequest obj_conv;
60507         obj_conv.inner = untag_ptr(obj);
60508         obj_conv.is_owned = ptr_is_owned(obj);
60509         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60510         obj_conv.is_owned = false;
60511         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
60512         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60513         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60514         CVec_u8Z_free(ret_var);
60515         return ret_arr;
60516 }
60517
60518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60519         LDKTaggedHash this_obj_conv;
60520         this_obj_conv.inner = untag_ptr(this_obj);
60521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60523         TaggedHash_free(this_obj_conv);
60524 }
60525
60526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60527         LDKBolt12ParseError this_obj_conv;
60528         this_obj_conv.inner = untag_ptr(this_obj);
60529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60531         Bolt12ParseError_free(this_obj_conv);
60532 }
60533
60534 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
60535         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
60536         int64_t ret_ref = 0;
60537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60539         return ret_ref;
60540 }
60541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60542         LDKBolt12ParseError arg_conv;
60543         arg_conv.inner = untag_ptr(arg);
60544         arg_conv.is_owned = ptr_is_owned(arg);
60545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60546         arg_conv.is_owned = false;
60547         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
60548         return ret_conv;
60549 }
60550
60551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60552         LDKBolt12ParseError orig_conv;
60553         orig_conv.inner = untag_ptr(orig);
60554         orig_conv.is_owned = ptr_is_owned(orig);
60555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60556         orig_conv.is_owned = false;
60557         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
60558         int64_t ret_ref = 0;
60559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60561         return ret_ref;
60562 }
60563
60564 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60565         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
60566         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
60567         return ret_conv;
60568 }
60569
60570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
60571         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
60572         return ret_conv;
60573 }
60574
60575 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
60576         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
60577         return ret_conv;
60578 }
60579
60580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
60581         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
60582         return ret_conv;
60583 }
60584
60585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
60586         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
60587         return ret_conv;
60588 }
60589
60590 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
60591         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
60592         return ret_conv;
60593 }
60594
60595 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
60596         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
60597         return ret_conv;
60598 }
60599
60600 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
60601         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
60602         return ret_conv;
60603 }
60604
60605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
60606         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
60607         return ret_conv;
60608 }
60609
60610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
60611         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
60612         return ret_conv;
60613 }
60614
60615 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
60616         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
60617         return ret_conv;
60618 }
60619
60620 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
60621         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
60622         return ret_conv;
60623 }
60624
60625 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
60626         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
60627         return ret_conv;
60628 }
60629
60630 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
60631         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
60632         return ret_conv;
60633 }
60634
60635 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
60636         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
60637         return ret_conv;
60638 }
60639
60640 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
60641         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
60642         return ret_conv;
60643 }
60644
60645 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
60646         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
60647         return ret_conv;
60648 }
60649
60650 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
60651         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
60652         return ret_conv;
60653 }
60654
60655 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
60656         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
60657         return ret_conv;
60658 }
60659
60660 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
60661         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
60662         return ret_conv;
60663 }
60664
60665 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
60666         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
60667         return ret_conv;
60668 }
60669
60670 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
60671         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
60672         return ret_conv;
60673 }
60674
60675 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
60676         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
60677         return ret_conv;
60678 }
60679
60680 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
60681         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
60682         return ret_conv;
60683 }
60684
60685 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
60686         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
60687         return ret_conv;
60688 }
60689
60690 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
60691         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
60692         return ret_conv;
60693 }
60694
60695 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
60696         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
60697         return ret_conv;
60698 }
60699
60700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60701         LDKRefund this_obj_conv;
60702         this_obj_conv.inner = untag_ptr(this_obj);
60703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60705         Refund_free(this_obj_conv);
60706 }
60707
60708 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
60709         LDKRefund ret_var = Refund_clone(arg);
60710         int64_t ret_ref = 0;
60711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60713         return ret_ref;
60714 }
60715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60716         LDKRefund arg_conv;
60717         arg_conv.inner = untag_ptr(arg);
60718         arg_conv.is_owned = ptr_is_owned(arg);
60719         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60720         arg_conv.is_owned = false;
60721         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
60722         return ret_conv;
60723 }
60724
60725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60726         LDKRefund orig_conv;
60727         orig_conv.inner = untag_ptr(orig);
60728         orig_conv.is_owned = ptr_is_owned(orig);
60729         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60730         orig_conv.is_owned = false;
60731         LDKRefund ret_var = Refund_clone(&orig_conv);
60732         int64_t ret_ref = 0;
60733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60735         return ret_ref;
60736 }
60737
60738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60739         LDKRefund this_arg_conv;
60740         this_arg_conv.inner = untag_ptr(this_arg);
60741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60743         this_arg_conv.is_owned = false;
60744         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
60745         int64_t ret_ref = 0;
60746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60748         return ret_ref;
60749 }
60750
60751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60752         LDKRefund this_arg_conv;
60753         this_arg_conv.inner = untag_ptr(this_arg);
60754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60756         this_arg_conv.is_owned = false;
60757         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60758         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
60759         int64_t ret_ref = tag_ptr(ret_copy, true);
60760         return ret_ref;
60761 }
60762
60763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
60764         LDKRefund this_arg_conv;
60765         this_arg_conv.inner = untag_ptr(this_arg);
60766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60768         this_arg_conv.is_owned = false;
60769         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
60770         return ret_conv;
60771 }
60772
60773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60774         LDKRefund this_arg_conv;
60775         this_arg_conv.inner = untag_ptr(this_arg);
60776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60778         this_arg_conv.is_owned = false;
60779         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
60780         int64_t ret_ref = 0;
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60783         return ret_ref;
60784 }
60785
60786 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60787         LDKRefund this_arg_conv;
60788         this_arg_conv.inner = untag_ptr(this_arg);
60789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60791         this_arg_conv.is_owned = false;
60792         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
60793         int64_tArray ret_arr = NULL;
60794         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60795         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60796         for (size_t n = 0; n < ret_var.datalen; n++) {
60797                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60798                 int64_t ret_conv_13_ref = 0;
60799                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60800                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60801                 ret_arr_ptr[n] = ret_conv_13_ref;
60802         }
60803         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60804         FREE(ret_var.data);
60805         return ret_arr;
60806 }
60807
60808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60809         LDKRefund this_arg_conv;
60810         this_arg_conv.inner = untag_ptr(this_arg);
60811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60813         this_arg_conv.is_owned = false;
60814         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
60815         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60816         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60817         return ret_arr;
60818 }
60819
60820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60821         LDKRefund this_arg_conv;
60822         this_arg_conv.inner = untag_ptr(this_arg);
60823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60825         this_arg_conv.is_owned = false;
60826         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60827         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
60828         return ret_arr;
60829 }
60830
60831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60832         LDKRefund this_arg_conv;
60833         this_arg_conv.inner = untag_ptr(this_arg);
60834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60836         this_arg_conv.is_owned = false;
60837         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
60838         return ret_conv;
60839 }
60840
60841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60842         LDKRefund this_arg_conv;
60843         this_arg_conv.inner = untag_ptr(this_arg);
60844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60846         this_arg_conv.is_owned = false;
60847         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
60848         int64_t ret_ref = 0;
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60851         return ret_ref;
60852 }
60853
60854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60855         LDKRefund this_arg_conv;
60856         this_arg_conv.inner = untag_ptr(this_arg);
60857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60859         this_arg_conv.is_owned = false;
60860         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60861         *ret_copy = Refund_quantity(&this_arg_conv);
60862         int64_t ret_ref = tag_ptr(ret_copy, true);
60863         return ret_ref;
60864 }
60865
60866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60867         LDKRefund this_arg_conv;
60868         this_arg_conv.inner = untag_ptr(this_arg);
60869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60871         this_arg_conv.is_owned = false;
60872         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
60874         return ret_arr;
60875 }
60876
60877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60878         LDKRefund this_arg_conv;
60879         this_arg_conv.inner = untag_ptr(this_arg);
60880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60882         this_arg_conv.is_owned = false;
60883         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
60884         int64_t ret_ref = 0;
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60887         return ret_ref;
60888 }
60889
60890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
60891         LDKRefund obj_conv;
60892         obj_conv.inner = untag_ptr(obj);
60893         obj_conv.is_owned = ptr_is_owned(obj);
60894         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60895         obj_conv.is_owned = false;
60896         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
60897         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60898         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60899         CVec_u8Z_free(ret_var);
60900         return ret_arr;
60901 }
60902
60903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
60904         LDKStr s_conv = java_to_owned_str(env, s);
60905         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
60906         *ret_conv = Refund_from_str(s_conv);
60907         return tag_ptr(ret_conv, true);
60908 }
60909
60910 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60911         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
60912         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
60913         return ret_conv;
60914 }
60915
60916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
60917         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
60918         return ret_conv;
60919 }
60920
60921 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
60922         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
60923         return ret_conv;
60924 }
60925
60926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60927         if (!ptr_is_owned(this_ptr)) return;
60928         void* this_ptr_ptr = untag_ptr(this_ptr);
60929         CHECK_ACCESS(this_ptr_ptr);
60930         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
60931         FREE(untag_ptr(this_ptr));
60932         UtxoResult_free(this_ptr_conv);
60933 }
60934
60935 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
60936         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60937         *ret_copy = UtxoResult_clone(arg);
60938         int64_t ret_ref = tag_ptr(ret_copy, true);
60939         return ret_ref;
60940 }
60941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60942         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
60943         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
60944         return ret_conv;
60945 }
60946
60947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60948         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
60949         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60950         *ret_copy = UtxoResult_clone(orig_conv);
60951         int64_t ret_ref = tag_ptr(ret_copy, true);
60952         return ret_ref;
60953 }
60954
60955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
60956         void* a_ptr = untag_ptr(a);
60957         CHECK_ACCESS(a_ptr);
60958         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
60959         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
60960         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60961         *ret_copy = UtxoResult_sync(a_conv);
60962         int64_t ret_ref = tag_ptr(ret_copy, true);
60963         return ret_ref;
60964 }
60965
60966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
60967         LDKUtxoFuture a_conv;
60968         a_conv.inner = untag_ptr(a);
60969         a_conv.is_owned = ptr_is_owned(a);
60970         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60971         a_conv = UtxoFuture_clone(&a_conv);
60972         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60973         *ret_copy = UtxoResult_async(a_conv);
60974         int64_t ret_ref = tag_ptr(ret_copy, true);
60975         return ret_ref;
60976 }
60977
60978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60979         if (!ptr_is_owned(this_ptr)) return;
60980         void* this_ptr_ptr = untag_ptr(this_ptr);
60981         CHECK_ACCESS(this_ptr_ptr);
60982         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
60983         FREE(untag_ptr(this_ptr));
60984         UtxoLookup_free(this_ptr_conv);
60985 }
60986
60987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60988         LDKUtxoFuture this_obj_conv;
60989         this_obj_conv.inner = untag_ptr(this_obj);
60990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60992         UtxoFuture_free(this_obj_conv);
60993 }
60994
60995 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
60996         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
60997         int64_t ret_ref = 0;
60998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61000         return ret_ref;
61001 }
61002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61003         LDKUtxoFuture arg_conv;
61004         arg_conv.inner = untag_ptr(arg);
61005         arg_conv.is_owned = ptr_is_owned(arg);
61006         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61007         arg_conv.is_owned = false;
61008         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
61009         return ret_conv;
61010 }
61011
61012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61013         LDKUtxoFuture orig_conv;
61014         orig_conv.inner = untag_ptr(orig);
61015         orig_conv.is_owned = ptr_is_owned(orig);
61016         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61017         orig_conv.is_owned = false;
61018         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
61019         int64_t ret_ref = 0;
61020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61022         return ret_ref;
61023 }
61024
61025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
61026         LDKUtxoFuture ret_var = UtxoFuture_new();
61027         int64_t ret_ref = 0;
61028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61030         return ret_ref;
61031 }
61032
61033 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) {
61034         LDKUtxoFuture this_arg_conv;
61035         this_arg_conv.inner = untag_ptr(this_arg);
61036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61038         this_arg_conv.is_owned = false;
61039         LDKNetworkGraph graph_conv;
61040         graph_conv.inner = untag_ptr(graph);
61041         graph_conv.is_owned = ptr_is_owned(graph);
61042         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61043         graph_conv.is_owned = false;
61044         void* result_ptr = untag_ptr(result);
61045         CHECK_ACCESS(result_ptr);
61046         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61047         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
61048 }
61049
61050 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) {
61051         LDKUtxoFuture this_arg_conv;
61052         this_arg_conv.inner = untag_ptr(this_arg);
61053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61055         this_arg_conv.is_owned = false;
61056         LDKNetworkGraph graph_conv;
61057         graph_conv.inner = untag_ptr(graph);
61058         graph_conv.is_owned = ptr_is_owned(graph);
61059         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61060         graph_conv.is_owned = false;
61061         LDKP2PGossipSync gossip_conv;
61062         gossip_conv.inner = untag_ptr(gossip);
61063         gossip_conv.is_owned = ptr_is_owned(gossip);
61064         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
61065         gossip_conv.is_owned = false;
61066         void* result_ptr = untag_ptr(result);
61067         CHECK_ACCESS(result_ptr);
61068         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61069         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
61070 }
61071
61072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61073         LDKNodeId this_obj_conv;
61074         this_obj_conv.inner = untag_ptr(this_obj);
61075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61077         NodeId_free(this_obj_conv);
61078 }
61079
61080 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
61081         LDKNodeId ret_var = NodeId_clone(arg);
61082         int64_t ret_ref = 0;
61083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61085         return ret_ref;
61086 }
61087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61088         LDKNodeId arg_conv;
61089         arg_conv.inner = untag_ptr(arg);
61090         arg_conv.is_owned = ptr_is_owned(arg);
61091         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61092         arg_conv.is_owned = false;
61093         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
61094         return ret_conv;
61095 }
61096
61097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61098         LDKNodeId orig_conv;
61099         orig_conv.inner = untag_ptr(orig);
61100         orig_conv.is_owned = ptr_is_owned(orig);
61101         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61102         orig_conv.is_owned = false;
61103         LDKNodeId ret_var = NodeId_clone(&orig_conv);
61104         int64_t ret_ref = 0;
61105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61107         return ret_ref;
61108 }
61109
61110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
61111         LDKPublicKey pubkey_ref;
61112         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
61113         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
61114         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
61115         int64_t ret_ref = 0;
61116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61118         return ret_ref;
61119 }
61120
61121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
61122         LDKNodeId this_arg_conv;
61123         this_arg_conv.inner = untag_ptr(this_arg);
61124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61126         this_arg_conv.is_owned = false;
61127         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
61128         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61129         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61130         return ret_arr;
61131 }
61132
61133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
61134         LDKNodeId this_arg_conv;
61135         this_arg_conv.inner = untag_ptr(this_arg);
61136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61138         this_arg_conv.is_owned = false;
61139         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61140         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
61141         return tag_ptr(ret_conv, true);
61142 }
61143
61144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
61145         LDKNodeId o_conv;
61146         o_conv.inner = untag_ptr(o);
61147         o_conv.is_owned = ptr_is_owned(o);
61148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61149         o_conv.is_owned = false;
61150         int64_t ret_conv = NodeId_hash(&o_conv);
61151         return ret_conv;
61152 }
61153
61154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
61155         LDKNodeId obj_conv;
61156         obj_conv.inner = untag_ptr(obj);
61157         obj_conv.is_owned = ptr_is_owned(obj);
61158         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61159         obj_conv.is_owned = false;
61160         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
61161         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61162         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61163         CVec_u8Z_free(ret_var);
61164         return ret_arr;
61165 }
61166
61167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61168         LDKu8slice ser_ref;
61169         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61170         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61171         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
61172         *ret_conv = NodeId_read(ser_ref);
61173         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61174         return tag_ptr(ret_conv, true);
61175 }
61176
61177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61178         LDKNetworkGraph this_obj_conv;
61179         this_obj_conv.inner = untag_ptr(this_obj);
61180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61182         NetworkGraph_free(this_obj_conv);
61183 }
61184
61185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61186         LDKReadOnlyNetworkGraph this_obj_conv;
61187         this_obj_conv.inner = untag_ptr(this_obj);
61188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61190         ReadOnlyNetworkGraph_free(this_obj_conv);
61191 }
61192
61193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61194         if (!ptr_is_owned(this_ptr)) return;
61195         void* this_ptr_ptr = untag_ptr(this_ptr);
61196         CHECK_ACCESS(this_ptr_ptr);
61197         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
61198         FREE(untag_ptr(this_ptr));
61199         NetworkUpdate_free(this_ptr_conv);
61200 }
61201
61202 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
61203         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61204         *ret_copy = NetworkUpdate_clone(arg);
61205         int64_t ret_ref = tag_ptr(ret_copy, true);
61206         return ret_ref;
61207 }
61208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61209         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
61210         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
61211         return ret_conv;
61212 }
61213
61214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61215         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
61216         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61217         *ret_copy = NetworkUpdate_clone(orig_conv);
61218         int64_t ret_ref = tag_ptr(ret_copy, true);
61219         return ret_ref;
61220 }
61221
61222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
61223         LDKChannelUpdate msg_conv;
61224         msg_conv.inner = untag_ptr(msg);
61225         msg_conv.is_owned = ptr_is_owned(msg);
61226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61227         msg_conv = ChannelUpdate_clone(&msg_conv);
61228         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61229         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
61230         int64_t ret_ref = tag_ptr(ret_copy, true);
61231         return ret_ref;
61232 }
61233
61234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
61235         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61236         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
61237         int64_t ret_ref = tag_ptr(ret_copy, true);
61238         return ret_ref;
61239 }
61240
61241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
61242         LDKPublicKey node_id_ref;
61243         CHECK((*env)->GetArrayLength(env, node_id) == 33);
61244         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
61245         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61246         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
61247         int64_t ret_ref = tag_ptr(ret_copy, true);
61248         return ret_ref;
61249 }
61250
61251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61252         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
61253         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
61254         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
61255         return ret_conv;
61256 }
61257
61258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61259         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
61260         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
61261         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61262         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61263         CVec_u8Z_free(ret_var);
61264         return ret_arr;
61265 }
61266
61267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61268         LDKu8slice ser_ref;
61269         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61270         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61271         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
61272         *ret_conv = NetworkUpdate_read(ser_ref);
61273         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61274         return tag_ptr(ret_conv, true);
61275 }
61276
61277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61278         LDKP2PGossipSync this_obj_conv;
61279         this_obj_conv.inner = untag_ptr(this_obj);
61280         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61282         P2PGossipSync_free(this_obj_conv);
61283 }
61284
61285 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) {
61286         LDKNetworkGraph network_graph_conv;
61287         network_graph_conv.inner = untag_ptr(network_graph);
61288         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61289         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61290         network_graph_conv.is_owned = false;
61291         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61292         CHECK_ACCESS(utxo_lookup_ptr);
61293         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61294         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61295         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61296                 // Manually implement clone for Java trait instances
61297                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61298                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61299                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61300                 }
61301         }
61302         void* logger_ptr = untag_ptr(logger);
61303         CHECK_ACCESS(logger_ptr);
61304         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61305         if (logger_conv.free == LDKLogger_JCalls_free) {
61306                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61307                 LDKLogger_JCalls_cloned(&logger_conv);
61308         }
61309         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
61310         int64_t ret_ref = 0;
61311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61313         return ret_ref;
61314 }
61315
61316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
61317         LDKP2PGossipSync this_arg_conv;
61318         this_arg_conv.inner = untag_ptr(this_arg);
61319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61321         this_arg_conv.is_owned = false;
61322         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61323         CHECK_ACCESS(utxo_lookup_ptr);
61324         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61325         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61326         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61327                 // Manually implement clone for Java trait instances
61328                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61329                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61330                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61331                 }
61332         }
61333         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
61334 }
61335
61336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
61337         LDKNetworkGraph this_arg_conv;
61338         this_arg_conv.inner = untag_ptr(this_arg);
61339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61341         this_arg_conv.is_owned = false;
61342         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
61343         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
61344 }
61345
61346 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1genesis_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
61347         LDKNetworkGraph this_arg_conv;
61348         this_arg_conv.inner = untag_ptr(this_arg);
61349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61351         this_arg_conv.is_owned = false;
61352         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61353         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_genesis_hash(&this_arg_conv).data);
61354         return ret_arr;
61355 }
61356
61357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
61358         LDKNodeAnnouncement msg_conv;
61359         msg_conv.inner = untag_ptr(msg);
61360         msg_conv.is_owned = ptr_is_owned(msg);
61361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61362         msg_conv.is_owned = false;
61363         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
61364         *ret_conv = verify_node_announcement(&msg_conv);
61365         return tag_ptr(ret_conv, true);
61366 }
61367
61368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
61369         LDKChannelAnnouncement msg_conv;
61370         msg_conv.inner = untag_ptr(msg);
61371         msg_conv.is_owned = ptr_is_owned(msg);
61372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61373         msg_conv.is_owned = false;
61374         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
61375         *ret_conv = verify_channel_announcement(&msg_conv);
61376         return tag_ptr(ret_conv, true);
61377 }
61378
61379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61380         LDKP2PGossipSync this_arg_conv;
61381         this_arg_conv.inner = untag_ptr(this_arg);
61382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61384         this_arg_conv.is_owned = false;
61385         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
61386         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
61387         return tag_ptr(ret_ret, true);
61388 }
61389
61390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61391         LDKP2PGossipSync this_arg_conv;
61392         this_arg_conv.inner = untag_ptr(this_arg);
61393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61395         this_arg_conv.is_owned = false;
61396         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
61397         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
61398         return tag_ptr(ret_ret, true);
61399 }
61400
61401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61402         LDKChannelUpdateInfo this_obj_conv;
61403         this_obj_conv.inner = untag_ptr(this_obj);
61404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61406         ChannelUpdateInfo_free(this_obj_conv);
61407 }
61408
61409 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
61410         LDKChannelUpdateInfo this_ptr_conv;
61411         this_ptr_conv.inner = untag_ptr(this_ptr);
61412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61414         this_ptr_conv.is_owned = false;
61415         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
61416         return ret_conv;
61417 }
61418
61419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
61420         LDKChannelUpdateInfo this_ptr_conv;
61421         this_ptr_conv.inner = untag_ptr(this_ptr);
61422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61424         this_ptr_conv.is_owned = false;
61425         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
61426 }
61427
61428 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
61429         LDKChannelUpdateInfo this_ptr_conv;
61430         this_ptr_conv.inner = untag_ptr(this_ptr);
61431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61433         this_ptr_conv.is_owned = false;
61434         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
61435         return ret_conv;
61436 }
61437
61438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
61439         LDKChannelUpdateInfo this_ptr_conv;
61440         this_ptr_conv.inner = untag_ptr(this_ptr);
61441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61443         this_ptr_conv.is_owned = false;
61444         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
61445 }
61446
61447 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
61448         LDKChannelUpdateInfo this_ptr_conv;
61449         this_ptr_conv.inner = untag_ptr(this_ptr);
61450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61452         this_ptr_conv.is_owned = false;
61453         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
61454         return ret_conv;
61455 }
61456
61457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
61458         LDKChannelUpdateInfo this_ptr_conv;
61459         this_ptr_conv.inner = untag_ptr(this_ptr);
61460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61462         this_ptr_conv.is_owned = false;
61463         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
61464 }
61465
61466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61467         LDKChannelUpdateInfo this_ptr_conv;
61468         this_ptr_conv.inner = untag_ptr(this_ptr);
61469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61471         this_ptr_conv.is_owned = false;
61472         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
61473         return ret_conv;
61474 }
61475
61476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61477         LDKChannelUpdateInfo this_ptr_conv;
61478         this_ptr_conv.inner = untag_ptr(this_ptr);
61479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61481         this_ptr_conv.is_owned = false;
61482         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
61483 }
61484
61485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61486         LDKChannelUpdateInfo this_ptr_conv;
61487         this_ptr_conv.inner = untag_ptr(this_ptr);
61488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61490         this_ptr_conv.is_owned = false;
61491         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
61492         return ret_conv;
61493 }
61494
61495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61496         LDKChannelUpdateInfo this_ptr_conv;
61497         this_ptr_conv.inner = untag_ptr(this_ptr);
61498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61500         this_ptr_conv.is_owned = false;
61501         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
61502 }
61503
61504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
61505         LDKChannelUpdateInfo this_ptr_conv;
61506         this_ptr_conv.inner = untag_ptr(this_ptr);
61507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61509         this_ptr_conv.is_owned = false;
61510         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
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 void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61518         LDKChannelUpdateInfo this_ptr_conv;
61519         this_ptr_conv.inner = untag_ptr(this_ptr);
61520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61522         this_ptr_conv.is_owned = false;
61523         LDKRoutingFees val_conv;
61524         val_conv.inner = untag_ptr(val);
61525         val_conv.is_owned = ptr_is_owned(val);
61526         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61527         val_conv = RoutingFees_clone(&val_conv);
61528         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
61529 }
61530
61531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
61532         LDKChannelUpdateInfo this_ptr_conv;
61533         this_ptr_conv.inner = untag_ptr(this_ptr);
61534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61536         this_ptr_conv.is_owned = false;
61537         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
61538         int64_t ret_ref = 0;
61539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61541         return ret_ref;
61542 }
61543
61544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61545         LDKChannelUpdateInfo this_ptr_conv;
61546         this_ptr_conv.inner = untag_ptr(this_ptr);
61547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61549         this_ptr_conv.is_owned = false;
61550         LDKChannelUpdate val_conv;
61551         val_conv.inner = untag_ptr(val);
61552         val_conv.is_owned = ptr_is_owned(val);
61553         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61554         val_conv = ChannelUpdate_clone(&val_conv);
61555         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
61556 }
61557
61558 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) {
61559         LDKRoutingFees fees_arg_conv;
61560         fees_arg_conv.inner = untag_ptr(fees_arg);
61561         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
61562         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
61563         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
61564         LDKChannelUpdate last_update_message_arg_conv;
61565         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
61566         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
61567         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
61568         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
61569         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);
61570         int64_t ret_ref = 0;
61571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61573         return ret_ref;
61574 }
61575
61576 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
61577         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
61578         int64_t ret_ref = 0;
61579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61581         return ret_ref;
61582 }
61583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61584         LDKChannelUpdateInfo arg_conv;
61585         arg_conv.inner = untag_ptr(arg);
61586         arg_conv.is_owned = ptr_is_owned(arg);
61587         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61588         arg_conv.is_owned = false;
61589         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
61590         return ret_conv;
61591 }
61592
61593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61594         LDKChannelUpdateInfo orig_conv;
61595         orig_conv.inner = untag_ptr(orig);
61596         orig_conv.is_owned = ptr_is_owned(orig);
61597         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61598         orig_conv.is_owned = false;
61599         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
61600         int64_t ret_ref = 0;
61601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61603         return ret_ref;
61604 }
61605
61606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61607         LDKChannelUpdateInfo a_conv;
61608         a_conv.inner = untag_ptr(a);
61609         a_conv.is_owned = ptr_is_owned(a);
61610         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61611         a_conv.is_owned = false;
61612         LDKChannelUpdateInfo b_conv;
61613         b_conv.inner = untag_ptr(b);
61614         b_conv.is_owned = ptr_is_owned(b);
61615         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61616         b_conv.is_owned = false;
61617         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
61618         return ret_conv;
61619 }
61620
61621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
61622         LDKChannelUpdateInfo obj_conv;
61623         obj_conv.inner = untag_ptr(obj);
61624         obj_conv.is_owned = ptr_is_owned(obj);
61625         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61626         obj_conv.is_owned = false;
61627         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
61628         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61629         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61630         CVec_u8Z_free(ret_var);
61631         return ret_arr;
61632 }
61633
61634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61635         LDKu8slice ser_ref;
61636         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61637         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61638         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
61639         *ret_conv = ChannelUpdateInfo_read(ser_ref);
61640         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61641         return tag_ptr(ret_conv, true);
61642 }
61643
61644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61645         LDKChannelInfo this_obj_conv;
61646         this_obj_conv.inner = untag_ptr(this_obj);
61647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61649         ChannelInfo_free(this_obj_conv);
61650 }
61651
61652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
61653         LDKChannelInfo this_ptr_conv;
61654         this_ptr_conv.inner = untag_ptr(this_ptr);
61655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61657         this_ptr_conv.is_owned = false;
61658         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
61659         int64_t ret_ref = 0;
61660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61662         return ret_ref;
61663 }
61664
61665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61666         LDKChannelInfo this_ptr_conv;
61667         this_ptr_conv.inner = untag_ptr(this_ptr);
61668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61670         this_ptr_conv.is_owned = false;
61671         LDKChannelFeatures val_conv;
61672         val_conv.inner = untag_ptr(val);
61673         val_conv.is_owned = ptr_is_owned(val);
61674         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61675         val_conv = ChannelFeatures_clone(&val_conv);
61676         ChannelInfo_set_features(&this_ptr_conv, val_conv);
61677 }
61678
61679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
61680         LDKChannelInfo this_ptr_conv;
61681         this_ptr_conv.inner = untag_ptr(this_ptr);
61682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61684         this_ptr_conv.is_owned = false;
61685         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
61686         int64_t ret_ref = 0;
61687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61689         return ret_ref;
61690 }
61691
61692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61693         LDKChannelInfo this_ptr_conv;
61694         this_ptr_conv.inner = untag_ptr(this_ptr);
61695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61697         this_ptr_conv.is_owned = false;
61698         LDKNodeId val_conv;
61699         val_conv.inner = untag_ptr(val);
61700         val_conv.is_owned = ptr_is_owned(val);
61701         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61702         val_conv = NodeId_clone(&val_conv);
61703         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
61704 }
61705
61706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
61707         LDKChannelInfo this_ptr_conv;
61708         this_ptr_conv.inner = untag_ptr(this_ptr);
61709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61711         this_ptr_conv.is_owned = false;
61712         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
61713         int64_t ret_ref = 0;
61714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61716         return ret_ref;
61717 }
61718
61719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61720         LDKChannelInfo this_ptr_conv;
61721         this_ptr_conv.inner = untag_ptr(this_ptr);
61722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61724         this_ptr_conv.is_owned = false;
61725         LDKChannelUpdateInfo val_conv;
61726         val_conv.inner = untag_ptr(val);
61727         val_conv.is_owned = ptr_is_owned(val);
61728         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61729         val_conv = ChannelUpdateInfo_clone(&val_conv);
61730         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
61731 }
61732
61733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
61734         LDKChannelInfo this_ptr_conv;
61735         this_ptr_conv.inner = untag_ptr(this_ptr);
61736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61738         this_ptr_conv.is_owned = false;
61739         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
61740         int64_t ret_ref = 0;
61741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61743         return ret_ref;
61744 }
61745
61746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61747         LDKChannelInfo this_ptr_conv;
61748         this_ptr_conv.inner = untag_ptr(this_ptr);
61749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61751         this_ptr_conv.is_owned = false;
61752         LDKNodeId val_conv;
61753         val_conv.inner = untag_ptr(val);
61754         val_conv.is_owned = ptr_is_owned(val);
61755         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61756         val_conv = NodeId_clone(&val_conv);
61757         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
61758 }
61759
61760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
61761         LDKChannelInfo this_ptr_conv;
61762         this_ptr_conv.inner = untag_ptr(this_ptr);
61763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61765         this_ptr_conv.is_owned = false;
61766         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
61767         int64_t ret_ref = 0;
61768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61770         return ret_ref;
61771 }
61772
61773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61774         LDKChannelInfo this_ptr_conv;
61775         this_ptr_conv.inner = untag_ptr(this_ptr);
61776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61778         this_ptr_conv.is_owned = false;
61779         LDKChannelUpdateInfo val_conv;
61780         val_conv.inner = untag_ptr(val);
61781         val_conv.is_owned = ptr_is_owned(val);
61782         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61783         val_conv = ChannelUpdateInfo_clone(&val_conv);
61784         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
61785 }
61786
61787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
61788         LDKChannelInfo this_ptr_conv;
61789         this_ptr_conv.inner = untag_ptr(this_ptr);
61790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61792         this_ptr_conv.is_owned = false;
61793         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61794         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
61795         int64_t ret_ref = tag_ptr(ret_copy, true);
61796         return ret_ref;
61797 }
61798
61799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61800         LDKChannelInfo this_ptr_conv;
61801         this_ptr_conv.inner = untag_ptr(this_ptr);
61802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61804         this_ptr_conv.is_owned = false;
61805         void* val_ptr = untag_ptr(val);
61806         CHECK_ACCESS(val_ptr);
61807         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
61808         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
61809         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
61810 }
61811
61812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
61813         LDKChannelInfo this_ptr_conv;
61814         this_ptr_conv.inner = untag_ptr(this_ptr);
61815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61817         this_ptr_conv.is_owned = false;
61818         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
61819         int64_t ret_ref = 0;
61820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61822         return ret_ref;
61823 }
61824
61825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61826         LDKChannelInfo this_ptr_conv;
61827         this_ptr_conv.inner = untag_ptr(this_ptr);
61828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61830         this_ptr_conv.is_owned = false;
61831         LDKChannelAnnouncement val_conv;
61832         val_conv.inner = untag_ptr(val);
61833         val_conv.is_owned = ptr_is_owned(val);
61834         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61835         val_conv = ChannelAnnouncement_clone(&val_conv);
61836         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
61837 }
61838
61839 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
61840         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
61841         int64_t ret_ref = 0;
61842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61844         return ret_ref;
61845 }
61846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61847         LDKChannelInfo arg_conv;
61848         arg_conv.inner = untag_ptr(arg);
61849         arg_conv.is_owned = ptr_is_owned(arg);
61850         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61851         arg_conv.is_owned = false;
61852         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
61853         return ret_conv;
61854 }
61855
61856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61857         LDKChannelInfo orig_conv;
61858         orig_conv.inner = untag_ptr(orig);
61859         orig_conv.is_owned = ptr_is_owned(orig);
61860         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61861         orig_conv.is_owned = false;
61862         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
61863         int64_t ret_ref = 0;
61864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61866         return ret_ref;
61867 }
61868
61869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61870         LDKChannelInfo a_conv;
61871         a_conv.inner = untag_ptr(a);
61872         a_conv.is_owned = ptr_is_owned(a);
61873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61874         a_conv.is_owned = false;
61875         LDKChannelInfo b_conv;
61876         b_conv.inner = untag_ptr(b);
61877         b_conv.is_owned = ptr_is_owned(b);
61878         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61879         b_conv.is_owned = false;
61880         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
61881         return ret_conv;
61882 }
61883
61884 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) {
61885         LDKChannelInfo this_arg_conv;
61886         this_arg_conv.inner = untag_ptr(this_arg);
61887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61889         this_arg_conv.is_owned = false;
61890         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
61891         int64_t ret_ref = 0;
61892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61894         return ret_ref;
61895 }
61896
61897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
61898         LDKChannelInfo obj_conv;
61899         obj_conv.inner = untag_ptr(obj);
61900         obj_conv.is_owned = ptr_is_owned(obj);
61901         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61902         obj_conv.is_owned = false;
61903         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
61904         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61905         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61906         CVec_u8Z_free(ret_var);
61907         return ret_arr;
61908 }
61909
61910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61911         LDKu8slice ser_ref;
61912         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61913         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61914         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
61915         *ret_conv = ChannelInfo_read(ser_ref);
61916         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61917         return tag_ptr(ret_conv, true);
61918 }
61919
61920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61921         LDKDirectedChannelInfo this_obj_conv;
61922         this_obj_conv.inner = untag_ptr(this_obj);
61923         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61925         DirectedChannelInfo_free(this_obj_conv);
61926 }
61927
61928 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
61929         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
61930         int64_t ret_ref = 0;
61931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61933         return ret_ref;
61934 }
61935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61936         LDKDirectedChannelInfo arg_conv;
61937         arg_conv.inner = untag_ptr(arg);
61938         arg_conv.is_owned = ptr_is_owned(arg);
61939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61940         arg_conv.is_owned = false;
61941         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
61942         return ret_conv;
61943 }
61944
61945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61946         LDKDirectedChannelInfo orig_conv;
61947         orig_conv.inner = untag_ptr(orig);
61948         orig_conv.is_owned = ptr_is_owned(orig);
61949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61950         orig_conv.is_owned = false;
61951         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
61952         int64_t ret_ref = 0;
61953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61955         return ret_ref;
61956 }
61957
61958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
61959         LDKDirectedChannelInfo this_arg_conv;
61960         this_arg_conv.inner = untag_ptr(this_arg);
61961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61963         this_arg_conv.is_owned = false;
61964         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
61965         int64_t ret_ref = 0;
61966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61968         return ret_ref;
61969 }
61970
61971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
61972         LDKDirectedChannelInfo this_arg_conv;
61973         this_arg_conv.inner = untag_ptr(this_arg);
61974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61976         this_arg_conv.is_owned = false;
61977         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
61978         return ret_conv;
61979 }
61980
61981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
61982         LDKDirectedChannelInfo this_arg_conv;
61983         this_arg_conv.inner = untag_ptr(this_arg);
61984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61986         this_arg_conv.is_owned = false;
61987         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
61988         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
61989         int64_t ret_ref = tag_ptr(ret_copy, true);
61990         return ret_ref;
61991 }
61992
61993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61994         if (!ptr_is_owned(this_ptr)) return;
61995         void* this_ptr_ptr = untag_ptr(this_ptr);
61996         CHECK_ACCESS(this_ptr_ptr);
61997         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
61998         FREE(untag_ptr(this_ptr));
61999         EffectiveCapacity_free(this_ptr_conv);
62000 }
62001
62002 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
62003         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62004         *ret_copy = EffectiveCapacity_clone(arg);
62005         int64_t ret_ref = tag_ptr(ret_copy, true);
62006         return ret_ref;
62007 }
62008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62009         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
62010         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
62011         return ret_conv;
62012 }
62013
62014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62015         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
62016         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62017         *ret_copy = EffectiveCapacity_clone(orig_conv);
62018         int64_t ret_ref = tag_ptr(ret_copy, true);
62019         return ret_ref;
62020 }
62021
62022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
62023         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62024         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
62025         int64_t ret_ref = tag_ptr(ret_copy, true);
62026         return ret_ref;
62027 }
62028
62029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62030         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62031         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
62032         int64_t ret_ref = tag_ptr(ret_copy, true);
62033         return ret_ref;
62034 }
62035
62036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
62037         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62038         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
62039         int64_t ret_ref = tag_ptr(ret_copy, true);
62040         return ret_ref;
62041 }
62042
62043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
62044         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62045         *ret_copy = EffectiveCapacity_infinite();
62046         int64_t ret_ref = tag_ptr(ret_copy, true);
62047         return ret_ref;
62048 }
62049
62050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62051         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62052         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
62053         int64_t ret_ref = tag_ptr(ret_copy, true);
62054         return ret_ref;
62055 }
62056
62057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
62058         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62059         *ret_copy = EffectiveCapacity_unknown();
62060         int64_t ret_ref = tag_ptr(ret_copy, true);
62061         return ret_ref;
62062 }
62063
62064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
62065         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
62066         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
62067         return ret_conv;
62068 }
62069
62070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62071         LDKRoutingFees this_obj_conv;
62072         this_obj_conv.inner = untag_ptr(this_obj);
62073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62075         RoutingFees_free(this_obj_conv);
62076 }
62077
62078 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62079         LDKRoutingFees this_ptr_conv;
62080         this_ptr_conv.inner = untag_ptr(this_ptr);
62081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62083         this_ptr_conv.is_owned = false;
62084         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
62085         return ret_conv;
62086 }
62087
62088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62089         LDKRoutingFees this_ptr_conv;
62090         this_ptr_conv.inner = untag_ptr(this_ptr);
62091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62093         this_ptr_conv.is_owned = false;
62094         RoutingFees_set_base_msat(&this_ptr_conv, val);
62095 }
62096
62097 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
62098         LDKRoutingFees this_ptr_conv;
62099         this_ptr_conv.inner = untag_ptr(this_ptr);
62100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62102         this_ptr_conv.is_owned = false;
62103         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
62104         return ret_conv;
62105 }
62106
62107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62108         LDKRoutingFees this_ptr_conv;
62109         this_ptr_conv.inner = untag_ptr(this_ptr);
62110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62112         this_ptr_conv.is_owned = false;
62113         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
62114 }
62115
62116 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) {
62117         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
62118         int64_t ret_ref = 0;
62119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62121         return ret_ref;
62122 }
62123
62124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62125         LDKRoutingFees a_conv;
62126         a_conv.inner = untag_ptr(a);
62127         a_conv.is_owned = ptr_is_owned(a);
62128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62129         a_conv.is_owned = false;
62130         LDKRoutingFees b_conv;
62131         b_conv.inner = untag_ptr(b);
62132         b_conv.is_owned = ptr_is_owned(b);
62133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62134         b_conv.is_owned = false;
62135         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
62136         return ret_conv;
62137 }
62138
62139 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
62140         LDKRoutingFees ret_var = RoutingFees_clone(arg);
62141         int64_t ret_ref = 0;
62142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62144         return ret_ref;
62145 }
62146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62147         LDKRoutingFees arg_conv;
62148         arg_conv.inner = untag_ptr(arg);
62149         arg_conv.is_owned = ptr_is_owned(arg);
62150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62151         arg_conv.is_owned = false;
62152         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
62153         return ret_conv;
62154 }
62155
62156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62157         LDKRoutingFees orig_conv;
62158         orig_conv.inner = untag_ptr(orig);
62159         orig_conv.is_owned = ptr_is_owned(orig);
62160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62161         orig_conv.is_owned = false;
62162         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
62163         int64_t ret_ref = 0;
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62166         return ret_ref;
62167 }
62168
62169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
62170         LDKRoutingFees o_conv;
62171         o_conv.inner = untag_ptr(o);
62172         o_conv.is_owned = ptr_is_owned(o);
62173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62174         o_conv.is_owned = false;
62175         int64_t ret_conv = RoutingFees_hash(&o_conv);
62176         return ret_conv;
62177 }
62178
62179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
62180         LDKRoutingFees obj_conv;
62181         obj_conv.inner = untag_ptr(obj);
62182         obj_conv.is_owned = ptr_is_owned(obj);
62183         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62184         obj_conv.is_owned = false;
62185         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
62186         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62187         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62188         CVec_u8Z_free(ret_var);
62189         return ret_arr;
62190 }
62191
62192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62193         LDKu8slice ser_ref;
62194         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62195         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62196         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
62197         *ret_conv = RoutingFees_read(ser_ref);
62198         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62199         return tag_ptr(ret_conv, true);
62200 }
62201
62202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62203         LDKNodeAnnouncementInfo this_obj_conv;
62204         this_obj_conv.inner = untag_ptr(this_obj);
62205         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62207         NodeAnnouncementInfo_free(this_obj_conv);
62208 }
62209
62210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62211         LDKNodeAnnouncementInfo this_ptr_conv;
62212         this_ptr_conv.inner = untag_ptr(this_ptr);
62213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62215         this_ptr_conv.is_owned = false;
62216         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
62217         int64_t ret_ref = 0;
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62220         return ret_ref;
62221 }
62222
62223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62224         LDKNodeAnnouncementInfo this_ptr_conv;
62225         this_ptr_conv.inner = untag_ptr(this_ptr);
62226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62228         this_ptr_conv.is_owned = false;
62229         LDKNodeFeatures val_conv;
62230         val_conv.inner = untag_ptr(val);
62231         val_conv.is_owned = ptr_is_owned(val);
62232         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62233         val_conv = NodeFeatures_clone(&val_conv);
62234         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
62235 }
62236
62237 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
62238         LDKNodeAnnouncementInfo this_ptr_conv;
62239         this_ptr_conv.inner = untag_ptr(this_ptr);
62240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62242         this_ptr_conv.is_owned = false;
62243         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
62244         return ret_conv;
62245 }
62246
62247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62248         LDKNodeAnnouncementInfo this_ptr_conv;
62249         this_ptr_conv.inner = untag_ptr(this_ptr);
62250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62252         this_ptr_conv.is_owned = false;
62253         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
62254 }
62255
62256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
62257         LDKNodeAnnouncementInfo this_ptr_conv;
62258         this_ptr_conv.inner = untag_ptr(this_ptr);
62259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62261         this_ptr_conv.is_owned = false;
62262         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
62263         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
62264         return ret_arr;
62265 }
62266
62267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62268         LDKNodeAnnouncementInfo this_ptr_conv;
62269         this_ptr_conv.inner = untag_ptr(this_ptr);
62270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62272         this_ptr_conv.is_owned = false;
62273         LDKThreeBytes val_ref;
62274         CHECK((*env)->GetArrayLength(env, val) == 3);
62275         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
62276         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
62277 }
62278
62279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
62280         LDKNodeAnnouncementInfo this_ptr_conv;
62281         this_ptr_conv.inner = untag_ptr(this_ptr);
62282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62284         this_ptr_conv.is_owned = false;
62285         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
62286         int64_t ret_ref = 0;
62287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62289         return ret_ref;
62290 }
62291
62292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62293         LDKNodeAnnouncementInfo this_ptr_conv;
62294         this_ptr_conv.inner = untag_ptr(this_ptr);
62295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62297         this_ptr_conv.is_owned = false;
62298         LDKNodeAlias val_conv;
62299         val_conv.inner = untag_ptr(val);
62300         val_conv.is_owned = ptr_is_owned(val);
62301         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62302         val_conv = NodeAlias_clone(&val_conv);
62303         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
62304 }
62305
62306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62307         LDKNodeAnnouncementInfo this_ptr_conv;
62308         this_ptr_conv.inner = untag_ptr(this_ptr);
62309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62311         this_ptr_conv.is_owned = false;
62312         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
62313         int64_t ret_ref = 0;
62314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62316         return ret_ref;
62317 }
62318
62319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62320         LDKNodeAnnouncementInfo this_ptr_conv;
62321         this_ptr_conv.inner = untag_ptr(this_ptr);
62322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62324         this_ptr_conv.is_owned = false;
62325         LDKNodeAnnouncement val_conv;
62326         val_conv.inner = untag_ptr(val);
62327         val_conv.is_owned = ptr_is_owned(val);
62328         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62329         val_conv = NodeAnnouncement_clone(&val_conv);
62330         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
62331 }
62332
62333 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) {
62334         LDKNodeFeatures features_arg_conv;
62335         features_arg_conv.inner = untag_ptr(features_arg);
62336         features_arg_conv.is_owned = ptr_is_owned(features_arg);
62337         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
62338         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
62339         LDKThreeBytes rgb_arg_ref;
62340         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
62341         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
62342         LDKNodeAlias alias_arg_conv;
62343         alias_arg_conv.inner = untag_ptr(alias_arg);
62344         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
62345         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
62346         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
62347         LDKNodeAnnouncement announcement_message_arg_conv;
62348         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
62349         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
62350         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
62351         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
62352         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
62353         int64_t ret_ref = 0;
62354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62356         return ret_ref;
62357 }
62358
62359 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
62360         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
62361         int64_t ret_ref = 0;
62362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62364         return ret_ref;
62365 }
62366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62367         LDKNodeAnnouncementInfo arg_conv;
62368         arg_conv.inner = untag_ptr(arg);
62369         arg_conv.is_owned = ptr_is_owned(arg);
62370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62371         arg_conv.is_owned = false;
62372         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
62373         return ret_conv;
62374 }
62375
62376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62377         LDKNodeAnnouncementInfo orig_conv;
62378         orig_conv.inner = untag_ptr(orig);
62379         orig_conv.is_owned = ptr_is_owned(orig);
62380         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62381         orig_conv.is_owned = false;
62382         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
62383         int64_t ret_ref = 0;
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62386         return ret_ref;
62387 }
62388
62389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62390         LDKNodeAnnouncementInfo a_conv;
62391         a_conv.inner = untag_ptr(a);
62392         a_conv.is_owned = ptr_is_owned(a);
62393         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62394         a_conv.is_owned = false;
62395         LDKNodeAnnouncementInfo b_conv;
62396         b_conv.inner = untag_ptr(b);
62397         b_conv.is_owned = ptr_is_owned(b);
62398         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62399         b_conv.is_owned = false;
62400         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
62401         return ret_conv;
62402 }
62403
62404 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
62405         LDKNodeAnnouncementInfo 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         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
62411         int64_tArray ret_arr = NULL;
62412         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
62413         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
62414         for (size_t p = 0; p < ret_var.datalen; p++) {
62415                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
62416                 *ret_conv_15_copy = ret_var.data[p];
62417                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
62418                 ret_arr_ptr[p] = ret_conv_15_ref;
62419         }
62420         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
62421         FREE(ret_var.data);
62422         return ret_arr;
62423 }
62424
62425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62426         LDKNodeAnnouncementInfo obj_conv;
62427         obj_conv.inner = untag_ptr(obj);
62428         obj_conv.is_owned = ptr_is_owned(obj);
62429         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62430         obj_conv.is_owned = false;
62431         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
62432         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62433         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62434         CVec_u8Z_free(ret_var);
62435         return ret_arr;
62436 }
62437
62438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62439         LDKu8slice ser_ref;
62440         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62441         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62442         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
62443         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
62444         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62445         return tag_ptr(ret_conv, true);
62446 }
62447
62448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62449         LDKNodeAlias this_obj_conv;
62450         this_obj_conv.inner = untag_ptr(this_obj);
62451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62453         NodeAlias_free(this_obj_conv);
62454 }
62455
62456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
62457         LDKNodeAlias this_ptr_conv;
62458         this_ptr_conv.inner = untag_ptr(this_ptr);
62459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62461         this_ptr_conv.is_owned = false;
62462         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62463         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
62464         return ret_arr;
62465 }
62466
62467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62468         LDKNodeAlias this_ptr_conv;
62469         this_ptr_conv.inner = untag_ptr(this_ptr);
62470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62472         this_ptr_conv.is_owned = false;
62473         LDKThirtyTwoBytes val_ref;
62474         CHECK((*env)->GetArrayLength(env, val) == 32);
62475         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62476         NodeAlias_set_a(&this_ptr_conv, val_ref);
62477 }
62478
62479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
62480         LDKThirtyTwoBytes a_arg_ref;
62481         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
62482         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
62483         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
62484         int64_t ret_ref = 0;
62485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62487         return ret_ref;
62488 }
62489
62490 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
62491         LDKNodeAlias ret_var = NodeAlias_clone(arg);
62492         int64_t ret_ref = 0;
62493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62495         return ret_ref;
62496 }
62497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62498         LDKNodeAlias arg_conv;
62499         arg_conv.inner = untag_ptr(arg);
62500         arg_conv.is_owned = ptr_is_owned(arg);
62501         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62502         arg_conv.is_owned = false;
62503         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
62504         return ret_conv;
62505 }
62506
62507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62508         LDKNodeAlias orig_conv;
62509         orig_conv.inner = untag_ptr(orig);
62510         orig_conv.is_owned = ptr_is_owned(orig);
62511         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62512         orig_conv.is_owned = false;
62513         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
62514         int64_t ret_ref = 0;
62515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62517         return ret_ref;
62518 }
62519
62520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62521         LDKNodeAlias a_conv;
62522         a_conv.inner = untag_ptr(a);
62523         a_conv.is_owned = ptr_is_owned(a);
62524         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62525         a_conv.is_owned = false;
62526         LDKNodeAlias b_conv;
62527         b_conv.inner = untag_ptr(b);
62528         b_conv.is_owned = ptr_is_owned(b);
62529         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62530         b_conv.is_owned = false;
62531         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
62532         return ret_conv;
62533 }
62534
62535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
62536         LDKNodeAlias obj_conv;
62537         obj_conv.inner = untag_ptr(obj);
62538         obj_conv.is_owned = ptr_is_owned(obj);
62539         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62540         obj_conv.is_owned = false;
62541         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
62542         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62543         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62544         CVec_u8Z_free(ret_var);
62545         return ret_arr;
62546 }
62547
62548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62549         LDKu8slice ser_ref;
62550         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62551         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62552         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
62553         *ret_conv = NodeAlias_read(ser_ref);
62554         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62555         return tag_ptr(ret_conv, true);
62556 }
62557
62558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62559         LDKNodeInfo this_obj_conv;
62560         this_obj_conv.inner = untag_ptr(this_obj);
62561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62563         NodeInfo_free(this_obj_conv);
62564 }
62565
62566 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
62567         LDKNodeInfo this_ptr_conv;
62568         this_ptr_conv.inner = untag_ptr(this_ptr);
62569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62571         this_ptr_conv.is_owned = false;
62572         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
62573         int64_tArray ret_arr = NULL;
62574         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
62575         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
62576         for (size_t g = 0; g < ret_var.datalen; g++) {
62577                 int64_t ret_conv_6_conv = ret_var.data[g];
62578                 ret_arr_ptr[g] = ret_conv_6_conv;
62579         }
62580         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
62581         FREE(ret_var.data);
62582         return ret_arr;
62583 }
62584
62585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
62586         LDKNodeInfo this_ptr_conv;
62587         this_ptr_conv.inner = untag_ptr(this_ptr);
62588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62590         this_ptr_conv.is_owned = false;
62591         LDKCVec_u64Z val_constr;
62592         val_constr.datalen = (*env)->GetArrayLength(env, val);
62593         if (val_constr.datalen > 0)
62594                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
62595         else
62596                 val_constr.data = NULL;
62597         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
62598         for (size_t g = 0; g < val_constr.datalen; g++) {
62599                 int64_t val_conv_6 = val_vals[g];
62600                 val_constr.data[g] = val_conv_6;
62601         }
62602         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
62603         NodeInfo_set_channels(&this_ptr_conv, val_constr);
62604 }
62605
62606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
62607         LDKNodeInfo this_ptr_conv;
62608         this_ptr_conv.inner = untag_ptr(this_ptr);
62609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62611         this_ptr_conv.is_owned = false;
62612         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
62613         int64_t ret_ref = 0;
62614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62616         return ret_ref;
62617 }
62618
62619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62620         LDKNodeInfo this_ptr_conv;
62621         this_ptr_conv.inner = untag_ptr(this_ptr);
62622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62624         this_ptr_conv.is_owned = false;
62625         LDKNodeAnnouncementInfo val_conv;
62626         val_conv.inner = untag_ptr(val);
62627         val_conv.is_owned = ptr_is_owned(val);
62628         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62629         val_conv = NodeAnnouncementInfo_clone(&val_conv);
62630         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
62631 }
62632
62633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
62634         LDKCVec_u64Z channels_arg_constr;
62635         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
62636         if (channels_arg_constr.datalen > 0)
62637                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
62638         else
62639                 channels_arg_constr.data = NULL;
62640         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
62641         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
62642                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
62643                 channels_arg_constr.data[g] = channels_arg_conv_6;
62644         }
62645         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
62646         LDKNodeAnnouncementInfo announcement_info_arg_conv;
62647         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
62648         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
62649         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
62650         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
62651         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
62652         int64_t ret_ref = 0;
62653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62655         return ret_ref;
62656 }
62657
62658 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
62659         LDKNodeInfo ret_var = NodeInfo_clone(arg);
62660         int64_t ret_ref = 0;
62661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62663         return ret_ref;
62664 }
62665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62666         LDKNodeInfo arg_conv;
62667         arg_conv.inner = untag_ptr(arg);
62668         arg_conv.is_owned = ptr_is_owned(arg);
62669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62670         arg_conv.is_owned = false;
62671         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
62672         return ret_conv;
62673 }
62674
62675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62676         LDKNodeInfo orig_conv;
62677         orig_conv.inner = untag_ptr(orig);
62678         orig_conv.is_owned = ptr_is_owned(orig);
62679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62680         orig_conv.is_owned = false;
62681         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
62682         int64_t ret_ref = 0;
62683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62685         return ret_ref;
62686 }
62687
62688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62689         LDKNodeInfo a_conv;
62690         a_conv.inner = untag_ptr(a);
62691         a_conv.is_owned = ptr_is_owned(a);
62692         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62693         a_conv.is_owned = false;
62694         LDKNodeInfo b_conv;
62695         b_conv.inner = untag_ptr(b);
62696         b_conv.is_owned = ptr_is_owned(b);
62697         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62698         b_conv.is_owned = false;
62699         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
62700         return ret_conv;
62701 }
62702
62703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62704         LDKNodeInfo obj_conv;
62705         obj_conv.inner = untag_ptr(obj);
62706         obj_conv.is_owned = ptr_is_owned(obj);
62707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62708         obj_conv.is_owned = false;
62709         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
62710         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62711         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62712         CVec_u8Z_free(ret_var);
62713         return ret_arr;
62714 }
62715
62716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62717         LDKu8slice ser_ref;
62718         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62719         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62720         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
62721         *ret_conv = NodeInfo_read(ser_ref);
62722         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62723         return tag_ptr(ret_conv, true);
62724 }
62725
62726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
62727         LDKNetworkGraph obj_conv;
62728         obj_conv.inner = untag_ptr(obj);
62729         obj_conv.is_owned = ptr_is_owned(obj);
62730         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62731         obj_conv.is_owned = false;
62732         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
62733         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62734         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62735         CVec_u8Z_free(ret_var);
62736         return ret_arr;
62737 }
62738
62739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
62740         LDKu8slice ser_ref;
62741         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62742         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62743         void* arg_ptr = untag_ptr(arg);
62744         CHECK_ACCESS(arg_ptr);
62745         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
62746         if (arg_conv.free == LDKLogger_JCalls_free) {
62747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62748                 LDKLogger_JCalls_cloned(&arg_conv);
62749         }
62750         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
62751         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
62752         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62753         return tag_ptr(ret_conv, true);
62754 }
62755
62756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
62757         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
62758         void* logger_ptr = untag_ptr(logger);
62759         CHECK_ACCESS(logger_ptr);
62760         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62761         if (logger_conv.free == LDKLogger_JCalls_free) {
62762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62763                 LDKLogger_JCalls_cloned(&logger_conv);
62764         }
62765         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
62766         int64_t ret_ref = 0;
62767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62769         return ret_ref;
62770 }
62771
62772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
62773         LDKNetworkGraph this_arg_conv;
62774         this_arg_conv.inner = untag_ptr(this_arg);
62775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62777         this_arg_conv.is_owned = false;
62778         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
62779         int64_t ret_ref = 0;
62780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62782         return ret_ref;
62783 }
62784
62785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
62786         LDKNetworkGraph this_arg_conv;
62787         this_arg_conv.inner = untag_ptr(this_arg);
62788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62790         this_arg_conv.is_owned = false;
62791         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
62792         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
62793         int64_t ret_ref = tag_ptr(ret_copy, true);
62794         return ret_ref;
62795 }
62796
62797 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) {
62798         LDKNetworkGraph this_arg_conv;
62799         this_arg_conv.inner = untag_ptr(this_arg);
62800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62802         this_arg_conv.is_owned = false;
62803         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
62804 }
62805
62806 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) {
62807         LDKNetworkGraph this_arg_conv;
62808         this_arg_conv.inner = untag_ptr(this_arg);
62809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62811         this_arg_conv.is_owned = false;
62812         LDKNodeAnnouncement msg_conv;
62813         msg_conv.inner = untag_ptr(msg);
62814         msg_conv.is_owned = ptr_is_owned(msg);
62815         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62816         msg_conv.is_owned = false;
62817         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62818         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
62819         return tag_ptr(ret_conv, true);
62820 }
62821
62822 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) {
62823         LDKNetworkGraph 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         LDKUnsignedNodeAnnouncement msg_conv;
62829         msg_conv.inner = untag_ptr(msg);
62830         msg_conv.is_owned = ptr_is_owned(msg);
62831         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62832         msg_conv.is_owned = false;
62833         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62834         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
62835         return tag_ptr(ret_conv, true);
62836 }
62837
62838 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) {
62839         LDKNetworkGraph this_arg_conv;
62840         this_arg_conv.inner = untag_ptr(this_arg);
62841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62843         this_arg_conv.is_owned = false;
62844         LDKChannelAnnouncement msg_conv;
62845         msg_conv.inner = untag_ptr(msg);
62846         msg_conv.is_owned = ptr_is_owned(msg);
62847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62848         msg_conv.is_owned = false;
62849         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62850         CHECK_ACCESS(utxo_lookup_ptr);
62851         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62852         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62853         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62854                 // Manually implement clone for Java trait instances
62855                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62856                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62857                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62858                 }
62859         }
62860         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62861         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
62862         return tag_ptr(ret_conv, true);
62863 }
62864
62865 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) {
62866         LDKNetworkGraph this_arg_conv;
62867         this_arg_conv.inner = untag_ptr(this_arg);
62868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62870         this_arg_conv.is_owned = false;
62871         LDKChannelAnnouncement msg_conv;
62872         msg_conv.inner = untag_ptr(msg);
62873         msg_conv.is_owned = ptr_is_owned(msg);
62874         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62875         msg_conv.is_owned = false;
62876         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62877         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
62878         return tag_ptr(ret_conv, true);
62879 }
62880
62881 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) {
62882         LDKNetworkGraph this_arg_conv;
62883         this_arg_conv.inner = untag_ptr(this_arg);
62884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62886         this_arg_conv.is_owned = false;
62887         LDKUnsignedChannelAnnouncement msg_conv;
62888         msg_conv.inner = untag_ptr(msg);
62889         msg_conv.is_owned = ptr_is_owned(msg);
62890         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62891         msg_conv.is_owned = false;
62892         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62893         CHECK_ACCESS(utxo_lookup_ptr);
62894         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62895         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62896         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62897                 // Manually implement clone for Java trait instances
62898                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62899                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62900                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62901                 }
62902         }
62903         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62904         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
62905         return tag_ptr(ret_conv, true);
62906 }
62907
62908 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) {
62909         LDKNetworkGraph 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         LDKChannelFeatures features_conv;
62915         features_conv.inner = untag_ptr(features);
62916         features_conv.is_owned = ptr_is_owned(features);
62917         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
62918         features_conv = ChannelFeatures_clone(&features_conv);
62919         LDKPublicKey node_id_1_ref;
62920         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
62921         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
62922         LDKPublicKey node_id_2_ref;
62923         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
62924         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
62925         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62926         *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);
62927         return tag_ptr(ret_conv, true);
62928 }
62929
62930 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) {
62931         LDKNetworkGraph this_arg_conv;
62932         this_arg_conv.inner = untag_ptr(this_arg);
62933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62935         this_arg_conv.is_owned = false;
62936         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
62937 }
62938
62939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
62940         LDKNetworkGraph this_arg_conv;
62941         this_arg_conv.inner = untag_ptr(this_arg);
62942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62944         this_arg_conv.is_owned = false;
62945         LDKPublicKey node_id_ref;
62946         CHECK((*env)->GetArrayLength(env, node_id) == 33);
62947         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
62948         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
62949 }
62950
62951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
62952         LDKNetworkGraph this_arg_conv;
62953         this_arg_conv.inner = untag_ptr(this_arg);
62954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62956         this_arg_conv.is_owned = false;
62957         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
62958 }
62959
62960 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) {
62961         LDKNetworkGraph this_arg_conv;
62962         this_arg_conv.inner = untag_ptr(this_arg);
62963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62965         this_arg_conv.is_owned = false;
62966         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
62967 }
62968
62969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
62970         LDKNetworkGraph this_arg_conv;
62971         this_arg_conv.inner = untag_ptr(this_arg);
62972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62974         this_arg_conv.is_owned = false;
62975         LDKChannelUpdate msg_conv;
62976         msg_conv.inner = untag_ptr(msg);
62977         msg_conv.is_owned = ptr_is_owned(msg);
62978         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62979         msg_conv.is_owned = false;
62980         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62981         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
62982         return tag_ptr(ret_conv, true);
62983 }
62984
62985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
62986         LDKNetworkGraph this_arg_conv;
62987         this_arg_conv.inner = untag_ptr(this_arg);
62988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62990         this_arg_conv.is_owned = false;
62991         LDKUnsignedChannelUpdate msg_conv;
62992         msg_conv.inner = untag_ptr(msg);
62993         msg_conv.is_owned = ptr_is_owned(msg);
62994         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62995         msg_conv.is_owned = false;
62996         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62997         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
62998         return tag_ptr(ret_conv, true);
62999 }
63000
63001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
63002         LDKReadOnlyNetworkGraph this_arg_conv;
63003         this_arg_conv.inner = untag_ptr(this_arg);
63004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63006         this_arg_conv.is_owned = false;
63007         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
63008         int64_t ret_ref = 0;
63009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63011         return ret_ref;
63012 }
63013
63014 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
63015         LDKReadOnlyNetworkGraph this_arg_conv;
63016         this_arg_conv.inner = untag_ptr(this_arg);
63017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63019         this_arg_conv.is_owned = false;
63020         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
63021         int64_tArray ret_arr = NULL;
63022         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63023         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63024         for (size_t g = 0; g < ret_var.datalen; g++) {
63025                 int64_t ret_conv_6_conv = ret_var.data[g];
63026                 ret_arr_ptr[g] = ret_conv_6_conv;
63027         }
63028         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63029         FREE(ret_var.data);
63030         return ret_arr;
63031 }
63032
63033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
63034         LDKReadOnlyNetworkGraph this_arg_conv;
63035         this_arg_conv.inner = untag_ptr(this_arg);
63036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63038         this_arg_conv.is_owned = false;
63039         LDKNodeId node_id_conv;
63040         node_id_conv.inner = untag_ptr(node_id);
63041         node_id_conv.is_owned = ptr_is_owned(node_id);
63042         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
63043         node_id_conv.is_owned = false;
63044         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
63045         int64_t ret_ref = 0;
63046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63048         return ret_ref;
63049 }
63050
63051 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
63052         LDKReadOnlyNetworkGraph this_arg_conv;
63053         this_arg_conv.inner = untag_ptr(this_arg);
63054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63056         this_arg_conv.is_owned = false;
63057         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
63058         int64_tArray ret_arr = NULL;
63059         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63060         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63061         for (size_t i = 0; i < ret_var.datalen; i++) {
63062                 LDKNodeId ret_conv_8_var = ret_var.data[i];
63063                 int64_t ret_conv_8_ref = 0;
63064                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
63065                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
63066                 ret_arr_ptr[i] = ret_conv_8_ref;
63067         }
63068         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63069         FREE(ret_var.data);
63070         return ret_arr;
63071 }
63072
63073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
63074         LDKReadOnlyNetworkGraph this_arg_conv;
63075         this_arg_conv.inner = untag_ptr(this_arg);
63076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63078         this_arg_conv.is_owned = false;
63079         LDKPublicKey pubkey_ref;
63080         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
63081         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
63082         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
63083         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
63084         int64_t ret_ref = tag_ptr(ret_copy, true);
63085         return ret_ref;
63086 }
63087
63088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63089         LDKDefaultRouter this_obj_conv;
63090         this_obj_conv.inner = untag_ptr(this_obj);
63091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63093         DefaultRouter_free(this_obj_conv);
63094 }
63095
63096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes, int64_t scorer, int64_t score_params) {
63097         LDKNetworkGraph network_graph_conv;
63098         network_graph_conv.inner = untag_ptr(network_graph);
63099         network_graph_conv.is_owned = ptr_is_owned(network_graph);
63100         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
63101         network_graph_conv.is_owned = false;
63102         void* logger_ptr = untag_ptr(logger);
63103         CHECK_ACCESS(logger_ptr);
63104         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63105         if (logger_conv.free == LDKLogger_JCalls_free) {
63106                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63107                 LDKLogger_JCalls_cloned(&logger_conv);
63108         }
63109         LDKThirtyTwoBytes random_seed_bytes_ref;
63110         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
63111         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
63112         void* scorer_ptr = untag_ptr(scorer);
63113         CHECK_ACCESS(scorer_ptr);
63114         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
63115         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
63116                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63117                 LDKLockableScore_JCalls_cloned(&scorer_conv);
63118         }
63119         LDKProbabilisticScoringFeeParameters score_params_conv;
63120         score_params_conv.inner = untag_ptr(score_params);
63121         score_params_conv.is_owned = ptr_is_owned(score_params);
63122         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
63123         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
63124         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
63125         int64_t ret_ref = 0;
63126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63128         return ret_ref;
63129 }
63130
63131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
63132         LDKDefaultRouter this_arg_conv;
63133         this_arg_conv.inner = untag_ptr(this_arg);
63134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63136         this_arg_conv.is_owned = false;
63137         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
63138         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
63139         return tag_ptr(ret_ret, true);
63140 }
63141
63142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63143         if (!ptr_is_owned(this_ptr)) return;
63144         void* this_ptr_ptr = untag_ptr(this_ptr);
63145         CHECK_ACCESS(this_ptr_ptr);
63146         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
63147         FREE(untag_ptr(this_ptr));
63148         Router_free(this_ptr_conv);
63149 }
63150
63151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63152         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
63153         this_obj_conv.inner = untag_ptr(this_obj);
63154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63156         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
63157 }
63158
63159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
63160         void* scorer_ptr = untag_ptr(scorer);
63161         CHECK_ACCESS(scorer_ptr);
63162         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
63163         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
63164                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63165                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
63166         }
63167         LDKInFlightHtlcs inflight_htlcs_conv;
63168         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
63169         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
63170         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
63171         inflight_htlcs_conv.is_owned = false;
63172         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
63173         int64_t ret_ref = 0;
63174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63176         return ret_ref;
63177 }
63178
63179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
63180         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
63181         this_arg_conv.inner = untag_ptr(this_arg);
63182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63184         this_arg_conv.is_owned = false;
63185         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
63186         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
63187         return tag_ptr(ret_ret, true);
63188 }
63189
63190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63191         LDKInFlightHtlcs this_obj_conv;
63192         this_obj_conv.inner = untag_ptr(this_obj);
63193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63195         InFlightHtlcs_free(this_obj_conv);
63196 }
63197
63198 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
63199         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
63200         int64_t ret_ref = 0;
63201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63203         return ret_ref;
63204 }
63205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63206         LDKInFlightHtlcs arg_conv;
63207         arg_conv.inner = untag_ptr(arg);
63208         arg_conv.is_owned = ptr_is_owned(arg);
63209         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63210         arg_conv.is_owned = false;
63211         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
63212         return ret_conv;
63213 }
63214
63215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63216         LDKInFlightHtlcs orig_conv;
63217         orig_conv.inner = untag_ptr(orig);
63218         orig_conv.is_owned = ptr_is_owned(orig);
63219         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63220         orig_conv.is_owned = false;
63221         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
63222         int64_t ret_ref = 0;
63223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63225         return ret_ref;
63226 }
63227
63228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
63229         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
63230         int64_t ret_ref = 0;
63231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63233         return ret_ref;
63234 }
63235
63236 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) {
63237         LDKInFlightHtlcs this_arg_conv;
63238         this_arg_conv.inner = untag_ptr(this_arg);
63239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63241         this_arg_conv.is_owned = false;
63242         LDKPath path_conv;
63243         path_conv.inner = untag_ptr(path);
63244         path_conv.is_owned = ptr_is_owned(path);
63245         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63246         path_conv.is_owned = false;
63247         LDKPublicKey payer_node_id_ref;
63248         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
63249         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
63250         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
63251 }
63252
63253 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) {
63254         LDKInFlightHtlcs this_arg_conv;
63255         this_arg_conv.inner = untag_ptr(this_arg);
63256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63258         this_arg_conv.is_owned = false;
63259         LDKNodeId source_conv;
63260         source_conv.inner = untag_ptr(source);
63261         source_conv.is_owned = ptr_is_owned(source);
63262         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63263         source_conv.is_owned = false;
63264         LDKNodeId target_conv;
63265         target_conv.inner = untag_ptr(target);
63266         target_conv.is_owned = ptr_is_owned(target);
63267         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63268         target_conv.is_owned = false;
63269         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
63270 }
63271
63272 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) {
63273         LDKInFlightHtlcs this_arg_conv;
63274         this_arg_conv.inner = untag_ptr(this_arg);
63275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63277         this_arg_conv.is_owned = false;
63278         LDKNodeId source_conv;
63279         source_conv.inner = untag_ptr(source);
63280         source_conv.is_owned = ptr_is_owned(source);
63281         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63282         source_conv.is_owned = false;
63283         LDKNodeId target_conv;
63284         target_conv.inner = untag_ptr(target);
63285         target_conv.is_owned = ptr_is_owned(target);
63286         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63287         target_conv.is_owned = false;
63288         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63289         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
63290         int64_t ret_ref = tag_ptr(ret_copy, true);
63291         return ret_ref;
63292 }
63293
63294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
63295         LDKInFlightHtlcs obj_conv;
63296         obj_conv.inner = untag_ptr(obj);
63297         obj_conv.is_owned = ptr_is_owned(obj);
63298         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63299         obj_conv.is_owned = false;
63300         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
63301         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63302         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63303         CVec_u8Z_free(ret_var);
63304         return ret_arr;
63305 }
63306
63307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63308         LDKu8slice ser_ref;
63309         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63310         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63311         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
63312         *ret_conv = InFlightHtlcs_read(ser_ref);
63313         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63314         return tag_ptr(ret_conv, true);
63315 }
63316
63317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63318         LDKRouteHop this_obj_conv;
63319         this_obj_conv.inner = untag_ptr(this_obj);
63320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63322         RouteHop_free(this_obj_conv);
63323 }
63324
63325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
63326         LDKRouteHop this_ptr_conv;
63327         this_ptr_conv.inner = untag_ptr(this_ptr);
63328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63330         this_ptr_conv.is_owned = false;
63331         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
63333         return ret_arr;
63334 }
63335
63336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63337         LDKRouteHop this_ptr_conv;
63338         this_ptr_conv.inner = untag_ptr(this_ptr);
63339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63341         this_ptr_conv.is_owned = false;
63342         LDKPublicKey val_ref;
63343         CHECK((*env)->GetArrayLength(env, val) == 33);
63344         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63345         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
63346 }
63347
63348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63349         LDKRouteHop this_ptr_conv;
63350         this_ptr_conv.inner = untag_ptr(this_ptr);
63351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63353         this_ptr_conv.is_owned = false;
63354         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
63355         int64_t ret_ref = 0;
63356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63358         return ret_ref;
63359 }
63360
63361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63362         LDKRouteHop this_ptr_conv;
63363         this_ptr_conv.inner = untag_ptr(this_ptr);
63364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63366         this_ptr_conv.is_owned = false;
63367         LDKNodeFeatures val_conv;
63368         val_conv.inner = untag_ptr(val);
63369         val_conv.is_owned = ptr_is_owned(val);
63370         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63371         val_conv = NodeFeatures_clone(&val_conv);
63372         RouteHop_set_node_features(&this_ptr_conv, val_conv);
63373 }
63374
63375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
63376         LDKRouteHop this_ptr_conv;
63377         this_ptr_conv.inner = untag_ptr(this_ptr);
63378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63380         this_ptr_conv.is_owned = false;
63381         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
63382         return ret_conv;
63383 }
63384
63385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63386         LDKRouteHop this_ptr_conv;
63387         this_ptr_conv.inner = untag_ptr(this_ptr);
63388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63390         this_ptr_conv.is_owned = false;
63391         RouteHop_set_short_channel_id(&this_ptr_conv, val);
63392 }
63393
63394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63395         LDKRouteHop this_ptr_conv;
63396         this_ptr_conv.inner = untag_ptr(this_ptr);
63397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63399         this_ptr_conv.is_owned = false;
63400         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
63401         int64_t ret_ref = 0;
63402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63404         return ret_ref;
63405 }
63406
63407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63408         LDKRouteHop this_ptr_conv;
63409         this_ptr_conv.inner = untag_ptr(this_ptr);
63410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63412         this_ptr_conv.is_owned = false;
63413         LDKChannelFeatures val_conv;
63414         val_conv.inner = untag_ptr(val);
63415         val_conv.is_owned = ptr_is_owned(val);
63416         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63417         val_conv = ChannelFeatures_clone(&val_conv);
63418         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
63419 }
63420
63421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
63422         LDKRouteHop this_ptr_conv;
63423         this_ptr_conv.inner = untag_ptr(this_ptr);
63424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63426         this_ptr_conv.is_owned = false;
63427         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
63428         return ret_conv;
63429 }
63430
63431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63432         LDKRouteHop this_ptr_conv;
63433         this_ptr_conv.inner = untag_ptr(this_ptr);
63434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63436         this_ptr_conv.is_owned = false;
63437         RouteHop_set_fee_msat(&this_ptr_conv, val);
63438 }
63439
63440 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
63441         LDKRouteHop this_ptr_conv;
63442         this_ptr_conv.inner = untag_ptr(this_ptr);
63443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63445         this_ptr_conv.is_owned = false;
63446         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
63447         return ret_conv;
63448 }
63449
63450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
63451         LDKRouteHop this_ptr_conv;
63452         this_ptr_conv.inner = untag_ptr(this_ptr);
63453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63455         this_ptr_conv.is_owned = false;
63456         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
63457 }
63458
63459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
63460         LDKRouteHop this_ptr_conv;
63461         this_ptr_conv.inner = untag_ptr(this_ptr);
63462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63464         this_ptr_conv.is_owned = false;
63465         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
63466         return ret_conv;
63467 }
63468
63469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63470         LDKRouteHop this_ptr_conv;
63471         this_ptr_conv.inner = untag_ptr(this_ptr);
63472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63474         this_ptr_conv.is_owned = false;
63475         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
63476 }
63477
63478 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) {
63479         LDKPublicKey pubkey_arg_ref;
63480         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
63481         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
63482         LDKNodeFeatures node_features_arg_conv;
63483         node_features_arg_conv.inner = untag_ptr(node_features_arg);
63484         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
63485         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
63486         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
63487         LDKChannelFeatures channel_features_arg_conv;
63488         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
63489         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
63490         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
63491         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
63492         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);
63493         int64_t ret_ref = 0;
63494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63496         return ret_ref;
63497 }
63498
63499 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
63500         LDKRouteHop ret_var = RouteHop_clone(arg);
63501         int64_t ret_ref = 0;
63502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63504         return ret_ref;
63505 }
63506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63507         LDKRouteHop arg_conv;
63508         arg_conv.inner = untag_ptr(arg);
63509         arg_conv.is_owned = ptr_is_owned(arg);
63510         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63511         arg_conv.is_owned = false;
63512         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
63513         return ret_conv;
63514 }
63515
63516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63517         LDKRouteHop orig_conv;
63518         orig_conv.inner = untag_ptr(orig);
63519         orig_conv.is_owned = ptr_is_owned(orig);
63520         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63521         orig_conv.is_owned = false;
63522         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
63523         int64_t ret_ref = 0;
63524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63526         return ret_ref;
63527 }
63528
63529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
63530         LDKRouteHop o_conv;
63531         o_conv.inner = untag_ptr(o);
63532         o_conv.is_owned = ptr_is_owned(o);
63533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63534         o_conv.is_owned = false;
63535         int64_t ret_conv = RouteHop_hash(&o_conv);
63536         return ret_conv;
63537 }
63538
63539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63540         LDKRouteHop a_conv;
63541         a_conv.inner = untag_ptr(a);
63542         a_conv.is_owned = ptr_is_owned(a);
63543         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63544         a_conv.is_owned = false;
63545         LDKRouteHop b_conv;
63546         b_conv.inner = untag_ptr(b);
63547         b_conv.is_owned = ptr_is_owned(b);
63548         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63549         b_conv.is_owned = false;
63550         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
63551         return ret_conv;
63552 }
63553
63554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
63555         LDKRouteHop obj_conv;
63556         obj_conv.inner = untag_ptr(obj);
63557         obj_conv.is_owned = ptr_is_owned(obj);
63558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63559         obj_conv.is_owned = false;
63560         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
63561         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63562         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63563         CVec_u8Z_free(ret_var);
63564         return ret_arr;
63565 }
63566
63567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63568         LDKu8slice ser_ref;
63569         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63570         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63571         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
63572         *ret_conv = RouteHop_read(ser_ref);
63573         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63574         return tag_ptr(ret_conv, true);
63575 }
63576
63577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63578         LDKBlindedTail this_obj_conv;
63579         this_obj_conv.inner = untag_ptr(this_obj);
63580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63582         BlindedTail_free(this_obj_conv);
63583 }
63584
63585 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
63586         LDKBlindedTail this_ptr_conv;
63587         this_ptr_conv.inner = untag_ptr(this_ptr);
63588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63590         this_ptr_conv.is_owned = false;
63591         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
63592         int64_tArray ret_arr = NULL;
63593         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63594         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63595         for (size_t m = 0; m < ret_var.datalen; m++) {
63596                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
63597                 int64_t ret_conv_12_ref = 0;
63598                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
63599                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
63600                 ret_arr_ptr[m] = ret_conv_12_ref;
63601         }
63602         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63603         FREE(ret_var.data);
63604         return ret_arr;
63605 }
63606
63607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
63608         LDKBlindedTail this_ptr_conv;
63609         this_ptr_conv.inner = untag_ptr(this_ptr);
63610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63612         this_ptr_conv.is_owned = false;
63613         LDKCVec_BlindedHopZ val_constr;
63614         val_constr.datalen = (*env)->GetArrayLength(env, val);
63615         if (val_constr.datalen > 0)
63616                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63617         else
63618                 val_constr.data = NULL;
63619         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
63620         for (size_t m = 0; m < val_constr.datalen; m++) {
63621                 int64_t val_conv_12 = val_vals[m];
63622                 LDKBlindedHop val_conv_12_conv;
63623                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
63624                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
63625                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
63626                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
63627                 val_constr.data[m] = val_conv_12_conv;
63628         }
63629         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
63630         BlindedTail_set_hops(&this_ptr_conv, val_constr);
63631 }
63632
63633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
63634         LDKBlindedTail this_ptr_conv;
63635         this_ptr_conv.inner = untag_ptr(this_ptr);
63636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63638         this_ptr_conv.is_owned = false;
63639         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63640         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
63641         return ret_arr;
63642 }
63643
63644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63645         LDKBlindedTail this_ptr_conv;
63646         this_ptr_conv.inner = untag_ptr(this_ptr);
63647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63649         this_ptr_conv.is_owned = false;
63650         LDKPublicKey val_ref;
63651         CHECK((*env)->GetArrayLength(env, val) == 33);
63652         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63653         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
63654 }
63655
63656 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
63657         LDKBlindedTail this_ptr_conv;
63658         this_ptr_conv.inner = untag_ptr(this_ptr);
63659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63661         this_ptr_conv.is_owned = false;
63662         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
63663         return ret_conv;
63664 }
63665
63666 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) {
63667         LDKBlindedTail this_ptr_conv;
63668         this_ptr_conv.inner = untag_ptr(this_ptr);
63669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63671         this_ptr_conv.is_owned = false;
63672         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
63673 }
63674
63675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
63676         LDKBlindedTail this_ptr_conv;
63677         this_ptr_conv.inner = untag_ptr(this_ptr);
63678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63680         this_ptr_conv.is_owned = false;
63681         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
63682         return ret_conv;
63683 }
63684
63685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63686         LDKBlindedTail this_ptr_conv;
63687         this_ptr_conv.inner = untag_ptr(this_ptr);
63688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63690         this_ptr_conv.is_owned = false;
63691         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
63692 }
63693
63694 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) {
63695         LDKCVec_BlindedHopZ hops_arg_constr;
63696         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
63697         if (hops_arg_constr.datalen > 0)
63698                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63699         else
63700                 hops_arg_constr.data = NULL;
63701         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
63702         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
63703                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
63704                 LDKBlindedHop hops_arg_conv_12_conv;
63705                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
63706                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
63707                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
63708                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
63709                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
63710         }
63711         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
63712         LDKPublicKey blinding_point_arg_ref;
63713         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
63714         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
63715         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
63716         int64_t ret_ref = 0;
63717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63719         return ret_ref;
63720 }
63721
63722 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
63723         LDKBlindedTail ret_var = BlindedTail_clone(arg);
63724         int64_t ret_ref = 0;
63725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63727         return ret_ref;
63728 }
63729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63730         LDKBlindedTail arg_conv;
63731         arg_conv.inner = untag_ptr(arg);
63732         arg_conv.is_owned = ptr_is_owned(arg);
63733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63734         arg_conv.is_owned = false;
63735         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
63736         return ret_conv;
63737 }
63738
63739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63740         LDKBlindedTail orig_conv;
63741         orig_conv.inner = untag_ptr(orig);
63742         orig_conv.is_owned = ptr_is_owned(orig);
63743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63744         orig_conv.is_owned = false;
63745         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
63746         int64_t ret_ref = 0;
63747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63749         return ret_ref;
63750 }
63751
63752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
63753         LDKBlindedTail o_conv;
63754         o_conv.inner = untag_ptr(o);
63755         o_conv.is_owned = ptr_is_owned(o);
63756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63757         o_conv.is_owned = false;
63758         int64_t ret_conv = BlindedTail_hash(&o_conv);
63759         return ret_conv;
63760 }
63761
63762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63763         LDKBlindedTail a_conv;
63764         a_conv.inner = untag_ptr(a);
63765         a_conv.is_owned = ptr_is_owned(a);
63766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63767         a_conv.is_owned = false;
63768         LDKBlindedTail b_conv;
63769         b_conv.inner = untag_ptr(b);
63770         b_conv.is_owned = ptr_is_owned(b);
63771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63772         b_conv.is_owned = false;
63773         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
63774         return ret_conv;
63775 }
63776
63777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
63778         LDKBlindedTail obj_conv;
63779         obj_conv.inner = untag_ptr(obj);
63780         obj_conv.is_owned = ptr_is_owned(obj);
63781         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63782         obj_conv.is_owned = false;
63783         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
63784         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63785         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63786         CVec_u8Z_free(ret_var);
63787         return ret_arr;
63788 }
63789
63790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63791         LDKu8slice ser_ref;
63792         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63793         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63794         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
63795         *ret_conv = BlindedTail_read(ser_ref);
63796         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63797         return tag_ptr(ret_conv, true);
63798 }
63799
63800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63801         LDKPath this_obj_conv;
63802         this_obj_conv.inner = untag_ptr(this_obj);
63803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63805         Path_free(this_obj_conv);
63806 }
63807
63808 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
63809         LDKPath this_ptr_conv;
63810         this_ptr_conv.inner = untag_ptr(this_ptr);
63811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63813         this_ptr_conv.is_owned = false;
63814         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
63815         int64_tArray ret_arr = NULL;
63816         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63817         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63818         for (size_t k = 0; k < ret_var.datalen; k++) {
63819                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
63820                 int64_t ret_conv_10_ref = 0;
63821                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
63822                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
63823                 ret_arr_ptr[k] = ret_conv_10_ref;
63824         }
63825         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63826         FREE(ret_var.data);
63827         return ret_arr;
63828 }
63829
63830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
63831         LDKPath this_ptr_conv;
63832         this_ptr_conv.inner = untag_ptr(this_ptr);
63833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63835         this_ptr_conv.is_owned = false;
63836         LDKCVec_RouteHopZ val_constr;
63837         val_constr.datalen = (*env)->GetArrayLength(env, val);
63838         if (val_constr.datalen > 0)
63839                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
63840         else
63841                 val_constr.data = NULL;
63842         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
63843         for (size_t k = 0; k < val_constr.datalen; k++) {
63844                 int64_t val_conv_10 = val_vals[k];
63845                 LDKRouteHop val_conv_10_conv;
63846                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
63847                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
63848                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
63849                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
63850                 val_constr.data[k] = val_conv_10_conv;
63851         }
63852         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
63853         Path_set_hops(&this_ptr_conv, val_constr);
63854 }
63855
63856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
63857         LDKPath this_ptr_conv;
63858         this_ptr_conv.inner = untag_ptr(this_ptr);
63859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63861         this_ptr_conv.is_owned = false;
63862         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
63863         int64_t ret_ref = 0;
63864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63866         return ret_ref;
63867 }
63868
63869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63870         LDKPath this_ptr_conv;
63871         this_ptr_conv.inner = untag_ptr(this_ptr);
63872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63874         this_ptr_conv.is_owned = false;
63875         LDKBlindedTail val_conv;
63876         val_conv.inner = untag_ptr(val);
63877         val_conv.is_owned = ptr_is_owned(val);
63878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63879         val_conv = BlindedTail_clone(&val_conv);
63880         Path_set_blinded_tail(&this_ptr_conv, val_conv);
63881 }
63882
63883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
63884         LDKCVec_RouteHopZ hops_arg_constr;
63885         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
63886         if (hops_arg_constr.datalen > 0)
63887                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
63888         else
63889                 hops_arg_constr.data = NULL;
63890         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
63891         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
63892                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
63893                 LDKRouteHop hops_arg_conv_10_conv;
63894                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
63895                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
63896                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
63897                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
63898                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
63899         }
63900         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
63901         LDKBlindedTail blinded_tail_arg_conv;
63902         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
63903         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
63904         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
63905         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
63906         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
63907         int64_t ret_ref = 0;
63908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63910         return ret_ref;
63911 }
63912
63913 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
63914         LDKPath ret_var = Path_clone(arg);
63915         int64_t ret_ref = 0;
63916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63918         return ret_ref;
63919 }
63920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63921         LDKPath arg_conv;
63922         arg_conv.inner = untag_ptr(arg);
63923         arg_conv.is_owned = ptr_is_owned(arg);
63924         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63925         arg_conv.is_owned = false;
63926         int64_t ret_conv = Path_clone_ptr(&arg_conv);
63927         return ret_conv;
63928 }
63929
63930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63931         LDKPath orig_conv;
63932         orig_conv.inner = untag_ptr(orig);
63933         orig_conv.is_owned = ptr_is_owned(orig);
63934         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63935         orig_conv.is_owned = false;
63936         LDKPath ret_var = Path_clone(&orig_conv);
63937         int64_t ret_ref = 0;
63938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63940         return ret_ref;
63941 }
63942
63943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
63944         LDKPath o_conv;
63945         o_conv.inner = untag_ptr(o);
63946         o_conv.is_owned = ptr_is_owned(o);
63947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63948         o_conv.is_owned = false;
63949         int64_t ret_conv = Path_hash(&o_conv);
63950         return ret_conv;
63951 }
63952
63953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63954         LDKPath a_conv;
63955         a_conv.inner = untag_ptr(a);
63956         a_conv.is_owned = ptr_is_owned(a);
63957         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63958         a_conv.is_owned = false;
63959         LDKPath b_conv;
63960         b_conv.inner = untag_ptr(b);
63961         b_conv.is_owned = ptr_is_owned(b);
63962         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63963         b_conv.is_owned = false;
63964         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
63965         return ret_conv;
63966 }
63967
63968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
63969         LDKPath this_arg_conv;
63970         this_arg_conv.inner = untag_ptr(this_arg);
63971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63973         this_arg_conv.is_owned = false;
63974         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
63975         return ret_conv;
63976 }
63977
63978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
63979         LDKPath this_arg_conv;
63980         this_arg_conv.inner = untag_ptr(this_arg);
63981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63983         this_arg_conv.is_owned = false;
63984         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
63985         return ret_conv;
63986 }
63987
63988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
63989         LDKPath this_arg_conv;
63990         this_arg_conv.inner = untag_ptr(this_arg);
63991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63993         this_arg_conv.is_owned = false;
63994         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63995         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
63996         int64_t ret_ref = tag_ptr(ret_copy, true);
63997         return ret_ref;
63998 }
63999
64000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64001         LDKRoute this_obj_conv;
64002         this_obj_conv.inner = untag_ptr(this_obj);
64003         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64005         Route_free(this_obj_conv);
64006 }
64007
64008 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
64009         LDKRoute this_ptr_conv;
64010         this_ptr_conv.inner = untag_ptr(this_ptr);
64011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64013         this_ptr_conv.is_owned = false;
64014         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
64015         int64_tArray ret_arr = NULL;
64016         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64017         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64018         for (size_t g = 0; g < ret_var.datalen; g++) {
64019                 LDKPath ret_conv_6_var = ret_var.data[g];
64020                 int64_t ret_conv_6_ref = 0;
64021                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
64022                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
64023                 ret_arr_ptr[g] = ret_conv_6_ref;
64024         }
64025         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64026         FREE(ret_var.data);
64027         return ret_arr;
64028 }
64029
64030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64031         LDKRoute this_ptr_conv;
64032         this_ptr_conv.inner = untag_ptr(this_ptr);
64033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64035         this_ptr_conv.is_owned = false;
64036         LDKCVec_PathZ val_constr;
64037         val_constr.datalen = (*env)->GetArrayLength(env, val);
64038         if (val_constr.datalen > 0)
64039                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64040         else
64041                 val_constr.data = NULL;
64042         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64043         for (size_t g = 0; g < val_constr.datalen; g++) {
64044                 int64_t val_conv_6 = val_vals[g];
64045                 LDKPath val_conv_6_conv;
64046                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
64047                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
64048                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
64049                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
64050                 val_constr.data[g] = val_conv_6_conv;
64051         }
64052         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64053         Route_set_paths(&this_ptr_conv, val_constr);
64054 }
64055
64056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64057         LDKRoute this_ptr_conv;
64058         this_ptr_conv.inner = untag_ptr(this_ptr);
64059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64061         this_ptr_conv.is_owned = false;
64062         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
64063         int64_t ret_ref = 0;
64064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64066         return ret_ref;
64067 }
64068
64069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64070         LDKRoute this_ptr_conv;
64071         this_ptr_conv.inner = untag_ptr(this_ptr);
64072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64074         this_ptr_conv.is_owned = false;
64075         LDKRouteParameters val_conv;
64076         val_conv.inner = untag_ptr(val);
64077         val_conv.is_owned = ptr_is_owned(val);
64078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64079         val_conv = RouteParameters_clone(&val_conv);
64080         Route_set_route_params(&this_ptr_conv, val_conv);
64081 }
64082
64083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
64084         LDKCVec_PathZ paths_arg_constr;
64085         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
64086         if (paths_arg_constr.datalen > 0)
64087                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64088         else
64089                 paths_arg_constr.data = NULL;
64090         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
64091         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
64092                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
64093                 LDKPath paths_arg_conv_6_conv;
64094                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
64095                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
64096                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
64097                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
64098                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
64099         }
64100         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
64101         LDKRouteParameters route_params_arg_conv;
64102         route_params_arg_conv.inner = untag_ptr(route_params_arg);
64103         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
64104         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
64105         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
64106         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
64107         int64_t ret_ref = 0;
64108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64110         return ret_ref;
64111 }
64112
64113 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
64114         LDKRoute ret_var = Route_clone(arg);
64115         int64_t ret_ref = 0;
64116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64118         return ret_ref;
64119 }
64120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64121         LDKRoute arg_conv;
64122         arg_conv.inner = untag_ptr(arg);
64123         arg_conv.is_owned = ptr_is_owned(arg);
64124         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64125         arg_conv.is_owned = false;
64126         int64_t ret_conv = Route_clone_ptr(&arg_conv);
64127         return ret_conv;
64128 }
64129
64130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64131         LDKRoute orig_conv;
64132         orig_conv.inner = untag_ptr(orig);
64133         orig_conv.is_owned = ptr_is_owned(orig);
64134         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64135         orig_conv.is_owned = false;
64136         LDKRoute ret_var = Route_clone(&orig_conv);
64137         int64_t ret_ref = 0;
64138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64140         return ret_ref;
64141 }
64142
64143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
64144         LDKRoute o_conv;
64145         o_conv.inner = untag_ptr(o);
64146         o_conv.is_owned = ptr_is_owned(o);
64147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64148         o_conv.is_owned = false;
64149         int64_t ret_conv = Route_hash(&o_conv);
64150         return ret_conv;
64151 }
64152
64153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64154         LDKRoute a_conv;
64155         a_conv.inner = untag_ptr(a);
64156         a_conv.is_owned = ptr_is_owned(a);
64157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64158         a_conv.is_owned = false;
64159         LDKRoute b_conv;
64160         b_conv.inner = untag_ptr(b);
64161         b_conv.is_owned = ptr_is_owned(b);
64162         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64163         b_conv.is_owned = false;
64164         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
64165         return ret_conv;
64166 }
64167
64168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
64169         LDKRoute this_arg_conv;
64170         this_arg_conv.inner = untag_ptr(this_arg);
64171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64173         this_arg_conv.is_owned = false;
64174         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
64175         return ret_conv;
64176 }
64177
64178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64179         LDKRoute this_arg_conv;
64180         this_arg_conv.inner = untag_ptr(this_arg);
64181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64183         this_arg_conv.is_owned = false;
64184         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
64185         return ret_conv;
64186 }
64187
64188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
64189         LDKRoute obj_conv;
64190         obj_conv.inner = untag_ptr(obj);
64191         obj_conv.is_owned = ptr_is_owned(obj);
64192         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64193         obj_conv.is_owned = false;
64194         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
64195         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64196         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64197         CVec_u8Z_free(ret_var);
64198         return ret_arr;
64199 }
64200
64201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64202         LDKu8slice ser_ref;
64203         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64204         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64205         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
64206         *ret_conv = Route_read(ser_ref);
64207         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64208         return tag_ptr(ret_conv, true);
64209 }
64210
64211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64212         LDKRouteParameters this_obj_conv;
64213         this_obj_conv.inner = untag_ptr(this_obj);
64214         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64216         RouteParameters_free(this_obj_conv);
64217 }
64218
64219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64220         LDKRouteParameters this_ptr_conv;
64221         this_ptr_conv.inner = untag_ptr(this_ptr);
64222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64224         this_ptr_conv.is_owned = false;
64225         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
64226         int64_t ret_ref = 0;
64227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64229         return ret_ref;
64230 }
64231
64232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64233         LDKRouteParameters this_ptr_conv;
64234         this_ptr_conv.inner = untag_ptr(this_ptr);
64235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64237         this_ptr_conv.is_owned = false;
64238         LDKPaymentParameters val_conv;
64239         val_conv.inner = untag_ptr(val);
64240         val_conv.is_owned = ptr_is_owned(val);
64241         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64242         val_conv = PaymentParameters_clone(&val_conv);
64243         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
64244 }
64245
64246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64247         LDKRouteParameters this_ptr_conv;
64248         this_ptr_conv.inner = untag_ptr(this_ptr);
64249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64251         this_ptr_conv.is_owned = false;
64252         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
64253         return ret_conv;
64254 }
64255
64256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64257         LDKRouteParameters this_ptr_conv;
64258         this_ptr_conv.inner = untag_ptr(this_ptr);
64259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64261         this_ptr_conv.is_owned = false;
64262         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
64263 }
64264
64265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64266         LDKRouteParameters this_ptr_conv;
64267         this_ptr_conv.inner = untag_ptr(this_ptr);
64268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64270         this_ptr_conv.is_owned = false;
64271         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64272         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
64273         int64_t ret_ref = tag_ptr(ret_copy, true);
64274         return ret_ref;
64275 }
64276
64277 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) {
64278         LDKRouteParameters this_ptr_conv;
64279         this_ptr_conv.inner = untag_ptr(this_ptr);
64280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64282         this_ptr_conv.is_owned = false;
64283         void* val_ptr = untag_ptr(val);
64284         CHECK_ACCESS(val_ptr);
64285         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
64286         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
64287         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
64288 }
64289
64290 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) {
64291         LDKPaymentParameters payment_params_arg_conv;
64292         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
64293         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
64294         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
64295         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
64296         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
64297         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
64298         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
64299         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
64300         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
64301         int64_t ret_ref = 0;
64302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64304         return ret_ref;
64305 }
64306
64307 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
64308         LDKRouteParameters ret_var = RouteParameters_clone(arg);
64309         int64_t ret_ref = 0;
64310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64312         return ret_ref;
64313 }
64314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64315         LDKRouteParameters arg_conv;
64316         arg_conv.inner = untag_ptr(arg);
64317         arg_conv.is_owned = ptr_is_owned(arg);
64318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64319         arg_conv.is_owned = false;
64320         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
64321         return ret_conv;
64322 }
64323
64324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64325         LDKRouteParameters orig_conv;
64326         orig_conv.inner = untag_ptr(orig);
64327         orig_conv.is_owned = ptr_is_owned(orig);
64328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64329         orig_conv.is_owned = false;
64330         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
64331         int64_t ret_ref = 0;
64332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64334         return ret_ref;
64335 }
64336
64337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
64338         LDKRouteParameters o_conv;
64339         o_conv.inner = untag_ptr(o);
64340         o_conv.is_owned = ptr_is_owned(o);
64341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64342         o_conv.is_owned = false;
64343         int64_t ret_conv = RouteParameters_hash(&o_conv);
64344         return ret_conv;
64345 }
64346
64347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64348         LDKRouteParameters a_conv;
64349         a_conv.inner = untag_ptr(a);
64350         a_conv.is_owned = ptr_is_owned(a);
64351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64352         a_conv.is_owned = false;
64353         LDKRouteParameters b_conv;
64354         b_conv.inner = untag_ptr(b);
64355         b_conv.is_owned = ptr_is_owned(b);
64356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64357         b_conv.is_owned = false;
64358         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
64359         return ret_conv;
64360 }
64361
64362 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) {
64363         LDKPaymentParameters payment_params_conv;
64364         payment_params_conv.inner = untag_ptr(payment_params);
64365         payment_params_conv.is_owned = ptr_is_owned(payment_params);
64366         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
64367         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
64368         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
64369         int64_t ret_ref = 0;
64370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64372         return ret_ref;
64373 }
64374
64375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64376         LDKRouteParameters obj_conv;
64377         obj_conv.inner = untag_ptr(obj);
64378         obj_conv.is_owned = ptr_is_owned(obj);
64379         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64380         obj_conv.is_owned = false;
64381         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
64382         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64383         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64384         CVec_u8Z_free(ret_var);
64385         return ret_arr;
64386 }
64387
64388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64389         LDKu8slice ser_ref;
64390         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64391         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64392         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
64393         *ret_conv = RouteParameters_read(ser_ref);
64394         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64395         return tag_ptr(ret_conv, true);
64396 }
64397
64398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64399         LDKPaymentParameters this_obj_conv;
64400         this_obj_conv.inner = untag_ptr(this_obj);
64401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64403         PaymentParameters_free(this_obj_conv);
64404 }
64405
64406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
64407         LDKPaymentParameters this_ptr_conv;
64408         this_ptr_conv.inner = untag_ptr(this_ptr);
64409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64411         this_ptr_conv.is_owned = false;
64412         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64413         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
64414         int64_t ret_ref = tag_ptr(ret_copy, true);
64415         return ret_ref;
64416 }
64417
64418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64419         LDKPaymentParameters this_ptr_conv;
64420         this_ptr_conv.inner = untag_ptr(this_ptr);
64421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64423         this_ptr_conv.is_owned = false;
64424         void* val_ptr = untag_ptr(val);
64425         CHECK_ACCESS(val_ptr);
64426         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
64427         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
64428         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
64429 }
64430
64431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
64432         LDKPaymentParameters this_ptr_conv;
64433         this_ptr_conv.inner = untag_ptr(this_ptr);
64434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64436         this_ptr_conv.is_owned = false;
64437         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64438         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
64439         int64_t ret_ref = tag_ptr(ret_copy, true);
64440         return ret_ref;
64441 }
64442
64443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64444         LDKPaymentParameters this_ptr_conv;
64445         this_ptr_conv.inner = untag_ptr(this_ptr);
64446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64448         this_ptr_conv.is_owned = false;
64449         void* val_ptr = untag_ptr(val);
64450         CHECK_ACCESS(val_ptr);
64451         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
64452         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
64453         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
64454 }
64455
64456 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
64457         LDKPaymentParameters this_ptr_conv;
64458         this_ptr_conv.inner = untag_ptr(this_ptr);
64459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64461         this_ptr_conv.is_owned = false;
64462         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
64463         return ret_conv;
64464 }
64465
64466 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) {
64467         LDKPaymentParameters this_ptr_conv;
64468         this_ptr_conv.inner = untag_ptr(this_ptr);
64469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64471         this_ptr_conv.is_owned = false;
64472         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
64473 }
64474
64475 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
64476         LDKPaymentParameters this_ptr_conv;
64477         this_ptr_conv.inner = untag_ptr(this_ptr);
64478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64480         this_ptr_conv.is_owned = false;
64481         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
64482         return ret_conv;
64483 }
64484
64485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
64486         LDKPaymentParameters this_ptr_conv;
64487         this_ptr_conv.inner = untag_ptr(this_ptr);
64488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64490         this_ptr_conv.is_owned = false;
64491         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
64492 }
64493
64494 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) {
64495         LDKPaymentParameters this_ptr_conv;
64496         this_ptr_conv.inner = untag_ptr(this_ptr);
64497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64499         this_ptr_conv.is_owned = false;
64500         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
64501         return ret_conv;
64502 }
64503
64504 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) {
64505         LDKPaymentParameters this_ptr_conv;
64506         this_ptr_conv.inner = untag_ptr(this_ptr);
64507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64509         this_ptr_conv.is_owned = false;
64510         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
64511 }
64512
64513 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
64514         LDKPaymentParameters this_ptr_conv;
64515         this_ptr_conv.inner = untag_ptr(this_ptr);
64516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64518         this_ptr_conv.is_owned = false;
64519         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
64520         int64_tArray ret_arr = NULL;
64521         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64522         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64523         for (size_t g = 0; g < ret_var.datalen; g++) {
64524                 int64_t ret_conv_6_conv = ret_var.data[g];
64525                 ret_arr_ptr[g] = ret_conv_6_conv;
64526         }
64527         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64528         FREE(ret_var.data);
64529         return ret_arr;
64530 }
64531
64532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64533         LDKPaymentParameters this_ptr_conv;
64534         this_ptr_conv.inner = untag_ptr(this_ptr);
64535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64537         this_ptr_conv.is_owned = false;
64538         LDKCVec_u64Z val_constr;
64539         val_constr.datalen = (*env)->GetArrayLength(env, val);
64540         if (val_constr.datalen > 0)
64541                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
64542         else
64543                 val_constr.data = NULL;
64544         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64545         for (size_t g = 0; g < val_constr.datalen; g++) {
64546                 int64_t val_conv_6 = val_vals[g];
64547                 val_constr.data[g] = val_conv_6;
64548         }
64549         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64550         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
64551 }
64552
64553 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) {
64554         void* payee_arg_ptr = untag_ptr(payee_arg);
64555         CHECK_ACCESS(payee_arg_ptr);
64556         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
64557         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
64558         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
64559         CHECK_ACCESS(expiry_time_arg_ptr);
64560         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
64561         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
64562         LDKCVec_u64Z previously_failed_channels_arg_constr;
64563         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
64564         if (previously_failed_channels_arg_constr.datalen > 0)
64565                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
64566         else
64567                 previously_failed_channels_arg_constr.data = NULL;
64568         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
64569         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
64570                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
64571                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
64572         }
64573         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
64574         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);
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 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
64582         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
64583         int64_t ret_ref = 0;
64584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64586         return ret_ref;
64587 }
64588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64589         LDKPaymentParameters arg_conv;
64590         arg_conv.inner = untag_ptr(arg);
64591         arg_conv.is_owned = ptr_is_owned(arg);
64592         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64593         arg_conv.is_owned = false;
64594         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
64595         return ret_conv;
64596 }
64597
64598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64599         LDKPaymentParameters orig_conv;
64600         orig_conv.inner = untag_ptr(orig);
64601         orig_conv.is_owned = ptr_is_owned(orig);
64602         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64603         orig_conv.is_owned = false;
64604         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
64605         int64_t ret_ref = 0;
64606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64608         return ret_ref;
64609 }
64610
64611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
64612         LDKPaymentParameters o_conv;
64613         o_conv.inner = untag_ptr(o);
64614         o_conv.is_owned = ptr_is_owned(o);
64615         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64616         o_conv.is_owned = false;
64617         int64_t ret_conv = PaymentParameters_hash(&o_conv);
64618         return ret_conv;
64619 }
64620
64621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64622         LDKPaymentParameters a_conv;
64623         a_conv.inner = untag_ptr(a);
64624         a_conv.is_owned = ptr_is_owned(a);
64625         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64626         a_conv.is_owned = false;
64627         LDKPaymentParameters b_conv;
64628         b_conv.inner = untag_ptr(b);
64629         b_conv.is_owned = ptr_is_owned(b);
64630         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64631         b_conv.is_owned = false;
64632         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
64633         return ret_conv;
64634 }
64635
64636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64637         LDKPaymentParameters obj_conv;
64638         obj_conv.inner = untag_ptr(obj);
64639         obj_conv.is_owned = ptr_is_owned(obj);
64640         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64641         obj_conv.is_owned = false;
64642         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
64643         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64644         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64645         CVec_u8Z_free(ret_var);
64646         return ret_arr;
64647 }
64648
64649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
64650         LDKu8slice ser_ref;
64651         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64652         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64653         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
64654         *ret_conv = PaymentParameters_read(ser_ref, arg);
64655         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64656         return tag_ptr(ret_conv, true);
64657 }
64658
64659 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) {
64660         LDKPublicKey payee_pubkey_ref;
64661         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
64662         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
64663         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
64664         int64_t ret_ref = 0;
64665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64667         return ret_ref;
64668 }
64669
64670 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) {
64671         LDKPublicKey payee_pubkey_ref;
64672         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
64673         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
64674         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
64675         int64_t ret_ref = 0;
64676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64678         return ret_ref;
64679 }
64680
64681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
64682         LDKBolt12Invoice invoice_conv;
64683         invoice_conv.inner = untag_ptr(invoice);
64684         invoice_conv.is_owned = ptr_is_owned(invoice);
64685         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
64686         invoice_conv.is_owned = false;
64687         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
64688         int64_t ret_ref = 0;
64689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64691         return ret_ref;
64692 }
64693
64694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
64695         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
64696         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
64697         if (blinded_route_hints_constr.datalen > 0)
64698                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
64699         else
64700                 blinded_route_hints_constr.data = NULL;
64701         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
64702         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
64703                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
64704                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
64705                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
64706                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
64707                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
64708                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
64709         }
64710         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
64711         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
64712         int64_t ret_ref = 0;
64713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64715         return ret_ref;
64716 }
64717
64718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64719         if (!ptr_is_owned(this_ptr)) return;
64720         void* this_ptr_ptr = untag_ptr(this_ptr);
64721         CHECK_ACCESS(this_ptr_ptr);
64722         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
64723         FREE(untag_ptr(this_ptr));
64724         Payee_free(this_ptr_conv);
64725 }
64726
64727 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
64728         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64729         *ret_copy = Payee_clone(arg);
64730         int64_t ret_ref = tag_ptr(ret_copy, true);
64731         return ret_ref;
64732 }
64733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64734         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
64735         int64_t ret_conv = Payee_clone_ptr(arg_conv);
64736         return ret_conv;
64737 }
64738
64739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64740         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
64741         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64742         *ret_copy = Payee_clone(orig_conv);
64743         int64_t ret_ref = tag_ptr(ret_copy, true);
64744         return ret_ref;
64745 }
64746
64747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
64748         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
64749         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
64750         if (route_hints_constr.datalen > 0)
64751                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
64752         else
64753                 route_hints_constr.data = NULL;
64754         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
64755         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
64756                 int64_t route_hints_conv_37 = route_hints_vals[l];
64757                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
64758                 CHECK_ACCESS(route_hints_conv_37_ptr);
64759                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
64760                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
64761                 route_hints_constr.data[l] = route_hints_conv_37_conv;
64762         }
64763         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
64764         LDKBolt12InvoiceFeatures features_conv;
64765         features_conv.inner = untag_ptr(features);
64766         features_conv.is_owned = ptr_is_owned(features);
64767         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64768         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
64769         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64770         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
64771         int64_t ret_ref = tag_ptr(ret_copy, true);
64772         return ret_ref;
64773 }
64774
64775 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) {
64776         LDKPublicKey node_id_ref;
64777         CHECK((*env)->GetArrayLength(env, node_id) == 33);
64778         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
64779         LDKCVec_RouteHintZ route_hints_constr;
64780         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
64781         if (route_hints_constr.datalen > 0)
64782                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
64783         else
64784                 route_hints_constr.data = NULL;
64785         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
64786         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
64787                 int64_t route_hints_conv_11 = route_hints_vals[l];
64788                 LDKRouteHint route_hints_conv_11_conv;
64789                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
64790                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
64791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
64792                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
64793                 route_hints_constr.data[l] = route_hints_conv_11_conv;
64794         }
64795         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
64796         LDKBolt11InvoiceFeatures features_conv;
64797         features_conv.inner = untag_ptr(features);
64798         features_conv.is_owned = ptr_is_owned(features);
64799         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64800         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
64801         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64802         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
64803         int64_t ret_ref = tag_ptr(ret_copy, true);
64804         return ret_ref;
64805 }
64806
64807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
64808         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
64809         int64_t ret_conv = Payee_hash(o_conv);
64810         return ret_conv;
64811 }
64812
64813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64814         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
64815         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
64816         jboolean ret_conv = Payee_eq(a_conv, b_conv);
64817         return ret_conv;
64818 }
64819
64820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64821         LDKRouteHint this_obj_conv;
64822         this_obj_conv.inner = untag_ptr(this_obj);
64823         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64825         RouteHint_free(this_obj_conv);
64826 }
64827
64828 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
64829         LDKRouteHint this_ptr_conv;
64830         this_ptr_conv.inner = untag_ptr(this_ptr);
64831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64833         this_ptr_conv.is_owned = false;
64834         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
64835         int64_tArray ret_arr = NULL;
64836         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64837         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64838         for (size_t o = 0; o < ret_var.datalen; o++) {
64839                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
64840                 int64_t ret_conv_14_ref = 0;
64841                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
64842                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
64843                 ret_arr_ptr[o] = ret_conv_14_ref;
64844         }
64845         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64846         FREE(ret_var.data);
64847         return ret_arr;
64848 }
64849
64850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64851         LDKRouteHint this_ptr_conv;
64852         this_ptr_conv.inner = untag_ptr(this_ptr);
64853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64855         this_ptr_conv.is_owned = false;
64856         LDKCVec_RouteHintHopZ val_constr;
64857         val_constr.datalen = (*env)->GetArrayLength(env, val);
64858         if (val_constr.datalen > 0)
64859                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
64860         else
64861                 val_constr.data = NULL;
64862         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64863         for (size_t o = 0; o < val_constr.datalen; o++) {
64864                 int64_t val_conv_14 = val_vals[o];
64865                 LDKRouteHintHop val_conv_14_conv;
64866                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
64867                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
64868                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
64869                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
64870                 val_constr.data[o] = val_conv_14_conv;
64871         }
64872         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64873         RouteHint_set_a(&this_ptr_conv, val_constr);
64874 }
64875
64876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
64877         LDKCVec_RouteHintHopZ a_arg_constr;
64878         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
64879         if (a_arg_constr.datalen > 0)
64880                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
64881         else
64882                 a_arg_constr.data = NULL;
64883         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
64884         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
64885                 int64_t a_arg_conv_14 = a_arg_vals[o];
64886                 LDKRouteHintHop a_arg_conv_14_conv;
64887                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
64888                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
64889                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
64890                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
64891                 a_arg_constr.data[o] = a_arg_conv_14_conv;
64892         }
64893         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
64894         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
64895         int64_t ret_ref = 0;
64896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64898         return ret_ref;
64899 }
64900
64901 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
64902         LDKRouteHint ret_var = RouteHint_clone(arg);
64903         int64_t ret_ref = 0;
64904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64906         return ret_ref;
64907 }
64908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64909         LDKRouteHint arg_conv;
64910         arg_conv.inner = untag_ptr(arg);
64911         arg_conv.is_owned = ptr_is_owned(arg);
64912         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64913         arg_conv.is_owned = false;
64914         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
64915         return ret_conv;
64916 }
64917
64918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64919         LDKRouteHint orig_conv;
64920         orig_conv.inner = untag_ptr(orig);
64921         orig_conv.is_owned = ptr_is_owned(orig);
64922         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64923         orig_conv.is_owned = false;
64924         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
64925         int64_t ret_ref = 0;
64926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64928         return ret_ref;
64929 }
64930
64931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
64932         LDKRouteHint o_conv;
64933         o_conv.inner = untag_ptr(o);
64934         o_conv.is_owned = ptr_is_owned(o);
64935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64936         o_conv.is_owned = false;
64937         int64_t ret_conv = RouteHint_hash(&o_conv);
64938         return ret_conv;
64939 }
64940
64941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64942         LDKRouteHint a_conv;
64943         a_conv.inner = untag_ptr(a);
64944         a_conv.is_owned = ptr_is_owned(a);
64945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64946         a_conv.is_owned = false;
64947         LDKRouteHint b_conv;
64948         b_conv.inner = untag_ptr(b);
64949         b_conv.is_owned = ptr_is_owned(b);
64950         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64951         b_conv.is_owned = false;
64952         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
64953         return ret_conv;
64954 }
64955
64956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
64957         LDKRouteHint obj_conv;
64958         obj_conv.inner = untag_ptr(obj);
64959         obj_conv.is_owned = ptr_is_owned(obj);
64960         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64961         obj_conv.is_owned = false;
64962         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
64963         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64964         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64965         CVec_u8Z_free(ret_var);
64966         return ret_arr;
64967 }
64968
64969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64970         LDKu8slice ser_ref;
64971         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64972         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64973         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
64974         *ret_conv = RouteHint_read(ser_ref);
64975         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64976         return tag_ptr(ret_conv, true);
64977 }
64978
64979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64980         LDKRouteHintHop this_obj_conv;
64981         this_obj_conv.inner = untag_ptr(this_obj);
64982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64984         RouteHintHop_free(this_obj_conv);
64985 }
64986
64987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
64988         LDKRouteHintHop this_ptr_conv;
64989         this_ptr_conv.inner = untag_ptr(this_ptr);
64990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64992         this_ptr_conv.is_owned = false;
64993         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
64995         return ret_arr;
64996 }
64997
64998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64999         LDKRouteHintHop this_ptr_conv;
65000         this_ptr_conv.inner = untag_ptr(this_ptr);
65001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65003         this_ptr_conv.is_owned = false;
65004         LDKPublicKey val_ref;
65005         CHECK((*env)->GetArrayLength(env, val) == 33);
65006         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
65007         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
65008 }
65009
65010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65011         LDKRouteHintHop this_ptr_conv;
65012         this_ptr_conv.inner = untag_ptr(this_ptr);
65013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65015         this_ptr_conv.is_owned = false;
65016         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
65017         return ret_conv;
65018 }
65019
65020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65021         LDKRouteHintHop this_ptr_conv;
65022         this_ptr_conv.inner = untag_ptr(this_ptr);
65023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65025         this_ptr_conv.is_owned = false;
65026         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
65027 }
65028
65029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
65030         LDKRouteHintHop this_ptr_conv;
65031         this_ptr_conv.inner = untag_ptr(this_ptr);
65032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65034         this_ptr_conv.is_owned = false;
65035         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
65036         int64_t ret_ref = 0;
65037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65039         return ret_ref;
65040 }
65041
65042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65043         LDKRouteHintHop this_ptr_conv;
65044         this_ptr_conv.inner = untag_ptr(this_ptr);
65045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65047         this_ptr_conv.is_owned = false;
65048         LDKRoutingFees val_conv;
65049         val_conv.inner = untag_ptr(val);
65050         val_conv.is_owned = ptr_is_owned(val);
65051         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65052         val_conv = RoutingFees_clone(&val_conv);
65053         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
65054 }
65055
65056 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65057         LDKRouteHintHop this_ptr_conv;
65058         this_ptr_conv.inner = untag_ptr(this_ptr);
65059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65061         this_ptr_conv.is_owned = false;
65062         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
65063         return ret_conv;
65064 }
65065
65066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65067         LDKRouteHintHop this_ptr_conv;
65068         this_ptr_conv.inner = untag_ptr(this_ptr);
65069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65071         this_ptr_conv.is_owned = false;
65072         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
65073 }
65074
65075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65076         LDKRouteHintHop this_ptr_conv;
65077         this_ptr_conv.inner = untag_ptr(this_ptr);
65078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65080         this_ptr_conv.is_owned = false;
65081         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65082         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
65083         int64_t ret_ref = tag_ptr(ret_copy, true);
65084         return ret_ref;
65085 }
65086
65087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65088         LDKRouteHintHop this_ptr_conv;
65089         this_ptr_conv.inner = untag_ptr(this_ptr);
65090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65092         this_ptr_conv.is_owned = false;
65093         void* val_ptr = untag_ptr(val);
65094         CHECK_ACCESS(val_ptr);
65095         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65096         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65097         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
65098 }
65099
65100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65101         LDKRouteHintHop this_ptr_conv;
65102         this_ptr_conv.inner = untag_ptr(this_ptr);
65103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65105         this_ptr_conv.is_owned = false;
65106         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65107         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
65108         int64_t ret_ref = tag_ptr(ret_copy, true);
65109         return ret_ref;
65110 }
65111
65112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65113         LDKRouteHintHop this_ptr_conv;
65114         this_ptr_conv.inner = untag_ptr(this_ptr);
65115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65117         this_ptr_conv.is_owned = false;
65118         void* val_ptr = untag_ptr(val);
65119         CHECK_ACCESS(val_ptr);
65120         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65121         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65122         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
65123 }
65124
65125 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) {
65126         LDKPublicKey src_node_id_arg_ref;
65127         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
65128         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
65129         LDKRoutingFees fees_arg_conv;
65130         fees_arg_conv.inner = untag_ptr(fees_arg);
65131         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
65132         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
65133         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
65134         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
65135         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
65136         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
65137         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
65138         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
65139         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
65140         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
65141         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
65142         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);
65143         int64_t ret_ref = 0;
65144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65146         return ret_ref;
65147 }
65148
65149 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
65150         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
65151         int64_t ret_ref = 0;
65152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65154         return ret_ref;
65155 }
65156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65157         LDKRouteHintHop arg_conv;
65158         arg_conv.inner = untag_ptr(arg);
65159         arg_conv.is_owned = ptr_is_owned(arg);
65160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65161         arg_conv.is_owned = false;
65162         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
65163         return ret_conv;
65164 }
65165
65166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65167         LDKRouteHintHop orig_conv;
65168         orig_conv.inner = untag_ptr(orig);
65169         orig_conv.is_owned = ptr_is_owned(orig);
65170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65171         orig_conv.is_owned = false;
65172         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
65173         int64_t ret_ref = 0;
65174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65176         return ret_ref;
65177 }
65178
65179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
65180         LDKRouteHintHop o_conv;
65181         o_conv.inner = untag_ptr(o);
65182         o_conv.is_owned = ptr_is_owned(o);
65183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65184         o_conv.is_owned = false;
65185         int64_t ret_conv = RouteHintHop_hash(&o_conv);
65186         return ret_conv;
65187 }
65188
65189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65190         LDKRouteHintHop a_conv;
65191         a_conv.inner = untag_ptr(a);
65192         a_conv.is_owned = ptr_is_owned(a);
65193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65194         a_conv.is_owned = false;
65195         LDKRouteHintHop b_conv;
65196         b_conv.inner = untag_ptr(b);
65197         b_conv.is_owned = ptr_is_owned(b);
65198         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65199         b_conv.is_owned = false;
65200         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
65201         return ret_conv;
65202 }
65203
65204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
65205         LDKRouteHintHop obj_conv;
65206         obj_conv.inner = untag_ptr(obj);
65207         obj_conv.is_owned = ptr_is_owned(obj);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65209         obj_conv.is_owned = false;
65210         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
65211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65213         CVec_u8Z_free(ret_var);
65214         return ret_arr;
65215 }
65216
65217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65218         LDKu8slice ser_ref;
65219         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65220         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65221         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
65222         *ret_conv = RouteHintHop_read(ser_ref);
65223         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65224         return tag_ptr(ret_conv, true);
65225 }
65226
65227 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) {
65228         LDKPublicKey our_node_pubkey_ref;
65229         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65230         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65231         LDKRouteParameters route_params_conv;
65232         route_params_conv.inner = untag_ptr(route_params);
65233         route_params_conv.is_owned = ptr_is_owned(route_params);
65234         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65235         route_params_conv.is_owned = false;
65236         LDKNetworkGraph network_graph_conv;
65237         network_graph_conv.inner = untag_ptr(network_graph);
65238         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65239         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65240         network_graph_conv.is_owned = false;
65241         LDKCVec_ChannelDetailsZ first_hops_constr;
65242         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
65243         if (first_hops != NULL) {
65244                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
65245                 if (first_hops_constr.datalen > 0)
65246                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
65247                 else
65248                         first_hops_constr.data = NULL;
65249                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
65250                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
65251                         int64_t first_hops_conv_16 = first_hops_vals[q];
65252                         LDKChannelDetails first_hops_conv_16_conv;
65253                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
65254                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
65255                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
65256                         first_hops_conv_16_conv.is_owned = false;
65257                         first_hops_constr.data[q] = first_hops_conv_16_conv;
65258                 }
65259                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
65260                 first_hops_ptr = &first_hops_constr;
65261         }
65262         void* logger_ptr = untag_ptr(logger);
65263         CHECK_ACCESS(logger_ptr);
65264         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65265         if (logger_conv.free == LDKLogger_JCalls_free) {
65266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65267                 LDKLogger_JCalls_cloned(&logger_conv);
65268         }
65269         void* scorer_ptr = untag_ptr(scorer);
65270         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
65271         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
65272         LDKProbabilisticScoringFeeParameters score_params_conv;
65273         score_params_conv.inner = untag_ptr(score_params);
65274         score_params_conv.is_owned = ptr_is_owned(score_params);
65275         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
65276         score_params_conv.is_owned = false;
65277         uint8_t random_seed_bytes_arr[32];
65278         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65279         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65280         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65281         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65282         *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);
65283         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
65284         return tag_ptr(ret_conv, true);
65285 }
65286
65287 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) {
65288         LDKPublicKey our_node_pubkey_ref;
65289         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65290         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65291         LDKCVec_PublicKeyZ hops_constr;
65292         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
65293         if (hops_constr.datalen > 0)
65294                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
65295         else
65296                 hops_constr.data = NULL;
65297         for (size_t i = 0; i < hops_constr.datalen; i++) {
65298                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
65299                 LDKPublicKey hops_conv_8_ref;
65300                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
65301                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
65302                 hops_constr.data[i] = hops_conv_8_ref;
65303         }
65304         LDKRouteParameters route_params_conv;
65305         route_params_conv.inner = untag_ptr(route_params);
65306         route_params_conv.is_owned = ptr_is_owned(route_params);
65307         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65308         route_params_conv.is_owned = false;
65309         LDKNetworkGraph network_graph_conv;
65310         network_graph_conv.inner = untag_ptr(network_graph);
65311         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65312         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65313         network_graph_conv.is_owned = false;
65314         void* logger_ptr = untag_ptr(logger);
65315         CHECK_ACCESS(logger_ptr);
65316         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65317         if (logger_conv.free == LDKLogger_JCalls_free) {
65318                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65319                 LDKLogger_JCalls_cloned(&logger_conv);
65320         }
65321         uint8_t random_seed_bytes_arr[32];
65322         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65323         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65324         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65325         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65326         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
65327         return tag_ptr(ret_conv, true);
65328 }
65329
65330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65331         if (!ptr_is_owned(this_ptr)) return;
65332         void* this_ptr_ptr = untag_ptr(this_ptr);
65333         CHECK_ACCESS(this_ptr_ptr);
65334         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
65335         FREE(untag_ptr(this_ptr));
65336         ScoreLookUp_free(this_ptr_conv);
65337 }
65338
65339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65340         if (!ptr_is_owned(this_ptr)) return;
65341         void* this_ptr_ptr = untag_ptr(this_ptr);
65342         CHECK_ACCESS(this_ptr_ptr);
65343         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
65344         FREE(untag_ptr(this_ptr));
65345         ScoreUpdate_free(this_ptr_conv);
65346 }
65347
65348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65349         if (!ptr_is_owned(this_ptr)) return;
65350         void* this_ptr_ptr = untag_ptr(this_ptr);
65351         CHECK_ACCESS(this_ptr_ptr);
65352         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
65353         FREE(untag_ptr(this_ptr));
65354         Score_free(this_ptr_conv);
65355 }
65356
65357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65358         if (!ptr_is_owned(this_ptr)) return;
65359         void* this_ptr_ptr = untag_ptr(this_ptr);
65360         CHECK_ACCESS(this_ptr_ptr);
65361         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
65362         FREE(untag_ptr(this_ptr));
65363         LockableScore_free(this_ptr_conv);
65364 }
65365
65366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65367         if (!ptr_is_owned(this_ptr)) return;
65368         void* this_ptr_ptr = untag_ptr(this_ptr);
65369         CHECK_ACCESS(this_ptr_ptr);
65370         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
65371         FREE(untag_ptr(this_ptr));
65372         WriteableScore_free(this_ptr_conv);
65373 }
65374
65375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65376         LDKMultiThreadedLockableScore this_obj_conv;
65377         this_obj_conv.inner = untag_ptr(this_obj);
65378         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65380         MultiThreadedLockableScore_free(this_obj_conv);
65381 }
65382
65383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
65384         LDKMultiThreadedLockableScore this_arg_conv;
65385         this_arg_conv.inner = untag_ptr(this_arg);
65386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65388         this_arg_conv.is_owned = false;
65389         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
65390         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
65391         return tag_ptr(ret_ret, true);
65392 }
65393
65394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
65395         LDKMultiThreadedLockableScore obj_conv;
65396         obj_conv.inner = untag_ptr(obj);
65397         obj_conv.is_owned = ptr_is_owned(obj);
65398         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65399         obj_conv.is_owned = false;
65400         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
65401         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65402         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65403         CVec_u8Z_free(ret_var);
65404         return ret_arr;
65405 }
65406
65407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
65408         LDKMultiThreadedLockableScore this_arg_conv;
65409         this_arg_conv.inner = untag_ptr(this_arg);
65410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65412         this_arg_conv.is_owned = false;
65413         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
65414         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
65415         return tag_ptr(ret_ret, true);
65416 }
65417
65418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
65419         void* score_ptr = untag_ptr(score);
65420         CHECK_ACCESS(score_ptr);
65421         LDKScore score_conv = *(LDKScore*)(score_ptr);
65422         if (score_conv.free == LDKScore_JCalls_free) {
65423                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65424                 LDKScore_JCalls_cloned(&score_conv);
65425         }
65426         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
65427         int64_t ret_ref = 0;
65428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65430         return ret_ref;
65431 }
65432
65433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65434         LDKMultiThreadedScoreLockRead this_obj_conv;
65435         this_obj_conv.inner = untag_ptr(this_obj);
65436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65438         MultiThreadedScoreLockRead_free(this_obj_conv);
65439 }
65440
65441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65442         LDKMultiThreadedScoreLockWrite this_obj_conv;
65443         this_obj_conv.inner = untag_ptr(this_obj);
65444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65446         MultiThreadedScoreLockWrite_free(this_obj_conv);
65447 }
65448
65449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
65450         LDKMultiThreadedScoreLockRead this_arg_conv;
65451         this_arg_conv.inner = untag_ptr(this_arg);
65452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65454         this_arg_conv.is_owned = false;
65455         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
65456         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
65457         return tag_ptr(ret_ret, true);
65458 }
65459
65460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
65461         LDKMultiThreadedScoreLockWrite obj_conv;
65462         obj_conv.inner = untag_ptr(obj);
65463         obj_conv.is_owned = ptr_is_owned(obj);
65464         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65465         obj_conv.is_owned = false;
65466         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
65467         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65468         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65469         CVec_u8Z_free(ret_var);
65470         return ret_arr;
65471 }
65472
65473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
65474         LDKMultiThreadedScoreLockWrite this_arg_conv;
65475         this_arg_conv.inner = untag_ptr(this_arg);
65476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65478         this_arg_conv.is_owned = false;
65479         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
65480         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
65481         return tag_ptr(ret_ret, true);
65482 }
65483
65484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65485         LDKChannelUsage this_obj_conv;
65486         this_obj_conv.inner = untag_ptr(this_obj);
65487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65489         ChannelUsage_free(this_obj_conv);
65490 }
65491
65492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65493         LDKChannelUsage this_ptr_conv;
65494         this_ptr_conv.inner = untag_ptr(this_ptr);
65495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65497         this_ptr_conv.is_owned = false;
65498         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
65499         return ret_conv;
65500 }
65501
65502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65503         LDKChannelUsage this_ptr_conv;
65504         this_ptr_conv.inner = untag_ptr(this_ptr);
65505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65507         this_ptr_conv.is_owned = false;
65508         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
65509 }
65510
65511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65512         LDKChannelUsage this_ptr_conv;
65513         this_ptr_conv.inner = untag_ptr(this_ptr);
65514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65516         this_ptr_conv.is_owned = false;
65517         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
65518         return ret_conv;
65519 }
65520
65521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65522         LDKChannelUsage this_ptr_conv;
65523         this_ptr_conv.inner = untag_ptr(this_ptr);
65524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65526         this_ptr_conv.is_owned = false;
65527         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
65528 }
65529
65530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
65531         LDKChannelUsage this_ptr_conv;
65532         this_ptr_conv.inner = untag_ptr(this_ptr);
65533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65535         this_ptr_conv.is_owned = false;
65536         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
65537         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
65538         int64_t ret_ref = tag_ptr(ret_copy, true);
65539         return ret_ref;
65540 }
65541
65542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65543         LDKChannelUsage this_ptr_conv;
65544         this_ptr_conv.inner = untag_ptr(this_ptr);
65545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65547         this_ptr_conv.is_owned = false;
65548         void* val_ptr = untag_ptr(val);
65549         CHECK_ACCESS(val_ptr);
65550         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
65551         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
65552         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
65553 }
65554
65555 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) {
65556         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
65557         CHECK_ACCESS(effective_capacity_arg_ptr);
65558         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
65559         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
65560         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
65561         int64_t ret_ref = 0;
65562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65564         return ret_ref;
65565 }
65566
65567 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
65568         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
65569         int64_t ret_ref = 0;
65570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65572         return ret_ref;
65573 }
65574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65575         LDKChannelUsage arg_conv;
65576         arg_conv.inner = untag_ptr(arg);
65577         arg_conv.is_owned = ptr_is_owned(arg);
65578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65579         arg_conv.is_owned = false;
65580         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
65581         return ret_conv;
65582 }
65583
65584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65585         LDKChannelUsage orig_conv;
65586         orig_conv.inner = untag_ptr(orig);
65587         orig_conv.is_owned = ptr_is_owned(orig);
65588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65589         orig_conv.is_owned = false;
65590         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
65591         int64_t ret_ref = 0;
65592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65594         return ret_ref;
65595 }
65596
65597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65598         LDKFixedPenaltyScorer this_obj_conv;
65599         this_obj_conv.inner = untag_ptr(this_obj);
65600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65602         FixedPenaltyScorer_free(this_obj_conv);
65603 }
65604
65605 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
65606         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
65607         int64_t ret_ref = 0;
65608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65610         return ret_ref;
65611 }
65612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65613         LDKFixedPenaltyScorer arg_conv;
65614         arg_conv.inner = untag_ptr(arg);
65615         arg_conv.is_owned = ptr_is_owned(arg);
65616         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65617         arg_conv.is_owned = false;
65618         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
65619         return ret_conv;
65620 }
65621
65622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65623         LDKFixedPenaltyScorer orig_conv;
65624         orig_conv.inner = untag_ptr(orig);
65625         orig_conv.is_owned = ptr_is_owned(orig);
65626         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65627         orig_conv.is_owned = false;
65628         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
65629         int64_t ret_ref = 0;
65630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65632         return ret_ref;
65633 }
65634
65635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
65636         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
65637         int64_t ret_ref = 0;
65638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65640         return ret_ref;
65641 }
65642
65643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
65644         LDKFixedPenaltyScorer this_arg_conv;
65645         this_arg_conv.inner = untag_ptr(this_arg);
65646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65648         this_arg_conv.is_owned = false;
65649         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
65650         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
65651         return tag_ptr(ret_ret, true);
65652 }
65653
65654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
65655         LDKFixedPenaltyScorer this_arg_conv;
65656         this_arg_conv.inner = untag_ptr(this_arg);
65657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65659         this_arg_conv.is_owned = false;
65660         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
65661         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
65662         return tag_ptr(ret_ret, true);
65663 }
65664
65665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
65666         LDKFixedPenaltyScorer obj_conv;
65667         obj_conv.inner = untag_ptr(obj);
65668         obj_conv.is_owned = ptr_is_owned(obj);
65669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65670         obj_conv.is_owned = false;
65671         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
65672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65674         CVec_u8Z_free(ret_var);
65675         return ret_arr;
65676 }
65677
65678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
65679         LDKu8slice ser_ref;
65680         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65681         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65682         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
65683         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
65684         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65685         return tag_ptr(ret_conv, true);
65686 }
65687
65688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65689         LDKProbabilisticScorer this_obj_conv;
65690         this_obj_conv.inner = untag_ptr(this_obj);
65691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65693         ProbabilisticScorer_free(this_obj_conv);
65694 }
65695
65696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65697         LDKProbabilisticScoringFeeParameters this_obj_conv;
65698         this_obj_conv.inner = untag_ptr(this_obj);
65699         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65701         ProbabilisticScoringFeeParameters_free(this_obj_conv);
65702 }
65703
65704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65705         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65706         this_ptr_conv.inner = untag_ptr(this_ptr);
65707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65709         this_ptr_conv.is_owned = false;
65710         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
65711         return ret_conv;
65712 }
65713
65714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65715         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65716         this_ptr_conv.inner = untag_ptr(this_ptr);
65717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65719         this_ptr_conv.is_owned = false;
65720         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
65721 }
65722
65723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65724         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65725         this_ptr_conv.inner = untag_ptr(this_ptr);
65726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65728         this_ptr_conv.is_owned = false;
65729         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
65730         return ret_conv;
65731 }
65732
65733 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) {
65734         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65735         this_ptr_conv.inner = untag_ptr(this_ptr);
65736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65738         this_ptr_conv.is_owned = false;
65739         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
65740 }
65741
65742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65743         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65744         this_ptr_conv.inner = untag_ptr(this_ptr);
65745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65747         this_ptr_conv.is_owned = false;
65748         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
65749         return ret_conv;
65750 }
65751
65752 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) {
65753         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65754         this_ptr_conv.inner = untag_ptr(this_ptr);
65755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65757         this_ptr_conv.is_owned = false;
65758         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
65759 }
65760
65761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65762         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65763         this_ptr_conv.inner = untag_ptr(this_ptr);
65764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65766         this_ptr_conv.is_owned = false;
65767         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
65768         return ret_conv;
65769 }
65770
65771 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) {
65772         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65773         this_ptr_conv.inner = untag_ptr(this_ptr);
65774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65776         this_ptr_conv.is_owned = false;
65777         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
65778 }
65779
65780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65781         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65782         this_ptr_conv.inner = untag_ptr(this_ptr);
65783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65785         this_ptr_conv.is_owned = false;
65786         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
65787         return ret_conv;
65788 }
65789
65790 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) {
65791         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65792         this_ptr_conv.inner = untag_ptr(this_ptr);
65793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65795         this_ptr_conv.is_owned = false;
65796         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
65797 }
65798
65799 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) {
65800         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65801         this_ptr_conv.inner = untag_ptr(this_ptr);
65802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65804         this_ptr_conv.is_owned = false;
65805         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
65806         return ret_conv;
65807 }
65808
65809 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) {
65810         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65811         this_ptr_conv.inner = untag_ptr(this_ptr);
65812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65814         this_ptr_conv.is_owned = false;
65815         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
65816 }
65817
65818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65819         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65820         this_ptr_conv.inner = untag_ptr(this_ptr);
65821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65823         this_ptr_conv.is_owned = false;
65824         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
65825         return ret_conv;
65826 }
65827
65828 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) {
65829         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65830         this_ptr_conv.inner = untag_ptr(this_ptr);
65831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65833         this_ptr_conv.is_owned = false;
65834         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
65835 }
65836
65837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65838         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65839         this_ptr_conv.inner = untag_ptr(this_ptr);
65840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65842         this_ptr_conv.is_owned = false;
65843         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
65844         return ret_conv;
65845 }
65846
65847 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) {
65848         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65849         this_ptr_conv.inner = untag_ptr(this_ptr);
65850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65852         this_ptr_conv.is_owned = false;
65853         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
65854 }
65855
65856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
65857         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65858         this_ptr_conv.inner = untag_ptr(this_ptr);
65859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65861         this_ptr_conv.is_owned = false;
65862         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
65863         return ret_conv;
65864 }
65865
65866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
65867         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65868         this_ptr_conv.inner = untag_ptr(this_ptr);
65869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65871         this_ptr_conv.is_owned = false;
65872         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
65873 }
65874
65875 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
65876         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
65877         int64_t ret_ref = 0;
65878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65880         return ret_ref;
65881 }
65882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65883         LDKProbabilisticScoringFeeParameters arg_conv;
65884         arg_conv.inner = untag_ptr(arg);
65885         arg_conv.is_owned = ptr_is_owned(arg);
65886         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65887         arg_conv.is_owned = false;
65888         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
65889         return ret_conv;
65890 }
65891
65892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65893         LDKProbabilisticScoringFeeParameters orig_conv;
65894         orig_conv.inner = untag_ptr(orig);
65895         orig_conv.is_owned = ptr_is_owned(orig);
65896         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65897         orig_conv.is_owned = false;
65898         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
65899         int64_t ret_ref = 0;
65900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65902         return ret_ref;
65903 }
65904
65905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
65906         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
65907         int64_t ret_ref = 0;
65908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65910         return ret_ref;
65911 }
65912
65913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
65914         LDKProbabilisticScoringFeeParameters this_arg_conv;
65915         this_arg_conv.inner = untag_ptr(this_arg);
65916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65918         this_arg_conv.is_owned = false;
65919         LDKNodeId node_id_conv;
65920         node_id_conv.inner = untag_ptr(node_id);
65921         node_id_conv.is_owned = ptr_is_owned(node_id);
65922         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65923         node_id_conv.is_owned = false;
65924         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
65925 }
65926
65927 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) {
65928         LDKProbabilisticScoringFeeParameters this_arg_conv;
65929         this_arg_conv.inner = untag_ptr(this_arg);
65930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65932         this_arg_conv.is_owned = false;
65933         LDKCVec_NodeIdZ node_ids_constr;
65934         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
65935         if (node_ids_constr.datalen > 0)
65936                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
65937         else
65938                 node_ids_constr.data = NULL;
65939         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
65940         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
65941                 int64_t node_ids_conv_8 = node_ids_vals[i];
65942                 LDKNodeId node_ids_conv_8_conv;
65943                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
65944                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
65945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
65946                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
65947                 node_ids_constr.data[i] = node_ids_conv_8_conv;
65948         }
65949         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
65950         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
65951 }
65952
65953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
65954         LDKProbabilisticScoringFeeParameters this_arg_conv;
65955         this_arg_conv.inner = untag_ptr(this_arg);
65956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65958         this_arg_conv.is_owned = false;
65959         LDKNodeId node_id_conv;
65960         node_id_conv.inner = untag_ptr(node_id);
65961         node_id_conv.is_owned = ptr_is_owned(node_id);
65962         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65963         node_id_conv.is_owned = false;
65964         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
65965 }
65966
65967 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) {
65968         LDKProbabilisticScoringFeeParameters this_arg_conv;
65969         this_arg_conv.inner = untag_ptr(this_arg);
65970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65972         this_arg_conv.is_owned = false;
65973         LDKNodeId node_id_conv;
65974         node_id_conv.inner = untag_ptr(node_id);
65975         node_id_conv.is_owned = ptr_is_owned(node_id);
65976         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65977         node_id_conv.is_owned = false;
65978         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
65979 }
65980
65981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
65982         LDKProbabilisticScoringFeeParameters this_arg_conv;
65983         this_arg_conv.inner = untag_ptr(this_arg);
65984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65986         this_arg_conv.is_owned = false;
65987         LDKNodeId node_id_conv;
65988         node_id_conv.inner = untag_ptr(node_id);
65989         node_id_conv.is_owned = ptr_is_owned(node_id);
65990         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65991         node_id_conv.is_owned = false;
65992         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
65993 }
65994
65995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
65996         LDKProbabilisticScoringFeeParameters this_arg_conv;
65997         this_arg_conv.inner = untag_ptr(this_arg);
65998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66000         this_arg_conv.is_owned = false;
66001         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
66002 }
66003
66004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66005         LDKProbabilisticScoringDecayParameters this_obj_conv;
66006         this_obj_conv.inner = untag_ptr(this_obj);
66007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66009         ProbabilisticScoringDecayParameters_free(this_obj_conv);
66010 }
66011
66012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66013         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66014         this_ptr_conv.inner = untag_ptr(this_ptr);
66015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66017         this_ptr_conv.is_owned = false;
66018         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
66019         return ret_conv;
66020 }
66021
66022 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) {
66023         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66024         this_ptr_conv.inner = untag_ptr(this_ptr);
66025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66027         this_ptr_conv.is_owned = false;
66028         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
66029 }
66030
66031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66032         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66033         this_ptr_conv.inner = untag_ptr(this_ptr);
66034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66036         this_ptr_conv.is_owned = false;
66037         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
66038         return ret_conv;
66039 }
66040
66041 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) {
66042         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66043         this_ptr_conv.inner = untag_ptr(this_ptr);
66044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66046         this_ptr_conv.is_owned = false;
66047         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
66048 }
66049
66050 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) {
66051         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
66052         int64_t ret_ref = 0;
66053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66055         return ret_ref;
66056 }
66057
66058 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
66059         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
66060         int64_t ret_ref = 0;
66061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66063         return ret_ref;
66064 }
66065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66066         LDKProbabilisticScoringDecayParameters arg_conv;
66067         arg_conv.inner = untag_ptr(arg);
66068         arg_conv.is_owned = ptr_is_owned(arg);
66069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66070         arg_conv.is_owned = false;
66071         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
66072         return ret_conv;
66073 }
66074
66075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66076         LDKProbabilisticScoringDecayParameters orig_conv;
66077         orig_conv.inner = untag_ptr(orig);
66078         orig_conv.is_owned = ptr_is_owned(orig);
66079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66080         orig_conv.is_owned = false;
66081         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
66082         int64_t ret_ref = 0;
66083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66085         return ret_ref;
66086 }
66087
66088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
66089         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
66090         int64_t ret_ref = 0;
66091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66093         return ret_ref;
66094 }
66095
66096 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) {
66097         LDKProbabilisticScoringDecayParameters decay_params_conv;
66098         decay_params_conv.inner = untag_ptr(decay_params);
66099         decay_params_conv.is_owned = ptr_is_owned(decay_params);
66100         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
66101         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
66102         LDKNetworkGraph network_graph_conv;
66103         network_graph_conv.inner = untag_ptr(network_graph);
66104         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66105         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66106         network_graph_conv.is_owned = false;
66107         void* logger_ptr = untag_ptr(logger);
66108         CHECK_ACCESS(logger_ptr);
66109         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66110         if (logger_conv.free == LDKLogger_JCalls_free) {
66111                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66112                 LDKLogger_JCalls_cloned(&logger_conv);
66113         }
66114         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
66115         int64_t ret_ref = 0;
66116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66118         return ret_ref;
66119 }
66120
66121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
66122         LDKProbabilisticScorer this_arg_conv;
66123         this_arg_conv.inner = untag_ptr(this_arg);
66124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66126         this_arg_conv.is_owned = false;
66127         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
66128 }
66129
66130 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) {
66131         LDKProbabilisticScorer this_arg_conv;
66132         this_arg_conv.inner = untag_ptr(this_arg);
66133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66135         this_arg_conv.is_owned = false;
66136         LDKNodeId target_conv;
66137         target_conv.inner = untag_ptr(target);
66138         target_conv.is_owned = ptr_is_owned(target);
66139         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66140         target_conv.is_owned = false;
66141         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
66142         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
66143         int64_t ret_ref = tag_ptr(ret_copy, true);
66144         return ret_ref;
66145 }
66146
66147 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) {
66148         LDKProbabilisticScorer this_arg_conv;
66149         this_arg_conv.inner = untag_ptr(this_arg);
66150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66152         this_arg_conv.is_owned = false;
66153         LDKNodeId target_conv;
66154         target_conv.inner = untag_ptr(target);
66155         target_conv.is_owned = ptr_is_owned(target);
66156         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66157         target_conv.is_owned = false;
66158         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
66159         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
66160         int64_t ret_ref = tag_ptr(ret_copy, true);
66161         return ret_ref;
66162 }
66163
66164 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) {
66165         LDKProbabilisticScorer this_arg_conv;
66166         this_arg_conv.inner = untag_ptr(this_arg);
66167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66169         this_arg_conv.is_owned = false;
66170         LDKNodeId target_conv;
66171         target_conv.inner = untag_ptr(target);
66172         target_conv.is_owned = ptr_is_owned(target);
66173         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66174         target_conv.is_owned = false;
66175         LDKProbabilisticScoringFeeParameters params_conv;
66176         params_conv.inner = untag_ptr(params);
66177         params_conv.is_owned = ptr_is_owned(params);
66178         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
66179         params_conv.is_owned = false;
66180         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
66181         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
66182         int64_t ret_ref = tag_ptr(ret_copy, true);
66183         return ret_ref;
66184 }
66185
66186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66187         LDKProbabilisticScorer this_arg_conv;
66188         this_arg_conv.inner = untag_ptr(this_arg);
66189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66191         this_arg_conv.is_owned = false;
66192         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66193         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
66194         return tag_ptr(ret_ret, true);
66195 }
66196
66197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66198         LDKProbabilisticScorer this_arg_conv;
66199         this_arg_conv.inner = untag_ptr(this_arg);
66200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66202         this_arg_conv.is_owned = false;
66203         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66204         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
66205         return tag_ptr(ret_ret, true);
66206 }
66207
66208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
66209         LDKProbabilisticScorer this_arg_conv;
66210         this_arg_conv.inner = untag_ptr(this_arg);
66211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66213         this_arg_conv.is_owned = false;
66214         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
66215         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
66216         return tag_ptr(ret_ret, true);
66217 }
66218
66219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
66220         LDKProbabilisticScorer obj_conv;
66221         obj_conv.inner = untag_ptr(obj);
66222         obj_conv.is_owned = ptr_is_owned(obj);
66223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66224         obj_conv.is_owned = false;
66225         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
66226         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66227         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66228         CVec_u8Z_free(ret_var);
66229         return ret_arr;
66230 }
66231
66232 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) {
66233         LDKu8slice ser_ref;
66234         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66235         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66236         LDKProbabilisticScoringDecayParameters arg_a_conv;
66237         arg_a_conv.inner = untag_ptr(arg_a);
66238         arg_a_conv.is_owned = ptr_is_owned(arg_a);
66239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
66240         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
66241         LDKNetworkGraph arg_b_conv;
66242         arg_b_conv.inner = untag_ptr(arg_b);
66243         arg_b_conv.is_owned = ptr_is_owned(arg_b);
66244         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
66245         arg_b_conv.is_owned = false;
66246         void* arg_c_ptr = untag_ptr(arg_c);
66247         CHECK_ACCESS(arg_c_ptr);
66248         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
66249         if (arg_c_conv.free == LDKLogger_JCalls_free) {
66250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66251                 LDKLogger_JCalls_cloned(&arg_c_conv);
66252         }
66253         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
66254         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
66255         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66256         return tag_ptr(ret_conv, true);
66257 }
66258
66259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66260         LDKDelayedPaymentOutputDescriptor this_obj_conv;
66261         this_obj_conv.inner = untag_ptr(this_obj);
66262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66264         DelayedPaymentOutputDescriptor_free(this_obj_conv);
66265 }
66266
66267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66268         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66269         this_ptr_conv.inner = untag_ptr(this_ptr);
66270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66272         this_ptr_conv.is_owned = false;
66273         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
66274         int64_t ret_ref = 0;
66275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66277         return ret_ref;
66278 }
66279
66280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66281         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66282         this_ptr_conv.inner = untag_ptr(this_ptr);
66283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66285         this_ptr_conv.is_owned = false;
66286         LDKOutPoint val_conv;
66287         val_conv.inner = untag_ptr(val);
66288         val_conv.is_owned = ptr_is_owned(val);
66289         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66290         val_conv = OutPoint_clone(&val_conv);
66291         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66292 }
66293
66294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
66295         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66296         this_ptr_conv.inner = untag_ptr(this_ptr);
66297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66299         this_ptr_conv.is_owned = false;
66300         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66301         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
66302         return ret_arr;
66303 }
66304
66305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66306         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66307         this_ptr_conv.inner = untag_ptr(this_ptr);
66308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66310         this_ptr_conv.is_owned = false;
66311         LDKPublicKey val_ref;
66312         CHECK((*env)->GetArrayLength(env, val) == 33);
66313         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66314         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66315 }
66316
66317 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
66318         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66319         this_ptr_conv.inner = untag_ptr(this_ptr);
66320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66322         this_ptr_conv.is_owned = false;
66323         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
66324         return ret_conv;
66325 }
66326
66327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
66328         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66329         this_ptr_conv.inner = untag_ptr(this_ptr);
66330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66332         this_ptr_conv.is_owned = false;
66333         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
66334 }
66335
66336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66337         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66338         this_ptr_conv.inner = untag_ptr(this_ptr);
66339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66341         this_ptr_conv.is_owned = false;
66342         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66343         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
66344         return tag_ptr(ret_ref, true);
66345 }
66346
66347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66348         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66349         this_ptr_conv.inner = untag_ptr(this_ptr);
66350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66352         this_ptr_conv.is_owned = false;
66353         void* val_ptr = untag_ptr(val);
66354         CHECK_ACCESS(val_ptr);
66355         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66356         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66357         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
66358 }
66359
66360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
66361         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66362         this_ptr_conv.inner = untag_ptr(this_ptr);
66363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66365         this_ptr_conv.is_owned = false;
66366         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66367         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
66368         return ret_arr;
66369 }
66370
66371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66372         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66373         this_ptr_conv.inner = untag_ptr(this_ptr);
66374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66376         this_ptr_conv.is_owned = false;
66377         LDKPublicKey val_ref;
66378         CHECK((*env)->GetArrayLength(env, val) == 33);
66379         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66380         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
66381 }
66382
66383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
66384         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66385         this_ptr_conv.inner = untag_ptr(this_ptr);
66386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66388         this_ptr_conv.is_owned = false;
66389         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66390         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
66391         return ret_arr;
66392 }
66393
66394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66395         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66396         this_ptr_conv.inner = untag_ptr(this_ptr);
66397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66399         this_ptr_conv.is_owned = false;
66400         LDKThirtyTwoBytes val_ref;
66401         CHECK((*env)->GetArrayLength(env, val) == 32);
66402         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
66403         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
66404 }
66405
66406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
66407         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66408         this_ptr_conv.inner = untag_ptr(this_ptr);
66409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66411         this_ptr_conv.is_owned = false;
66412         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
66413         return ret_conv;
66414 }
66415
66416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66417         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66418         this_ptr_conv.inner = untag_ptr(this_ptr);
66419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66421         this_ptr_conv.is_owned = false;
66422         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
66423 }
66424
66425 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, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
66426         LDKOutPoint outpoint_arg_conv;
66427         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66428         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66429         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66430         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66431         LDKPublicKey per_commitment_point_arg_ref;
66432         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
66433         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
66434         void* output_arg_ptr = untag_ptr(output_arg);
66435         CHECK_ACCESS(output_arg_ptr);
66436         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66437         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66438         LDKPublicKey revocation_pubkey_arg_ref;
66439         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
66440         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
66441         LDKThirtyTwoBytes channel_keys_id_arg_ref;
66442         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
66443         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
66444         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
66445         int64_t ret_ref = 0;
66446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66448         return ret_ref;
66449 }
66450
66451 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
66452         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
66453         int64_t ret_ref = 0;
66454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66456         return ret_ref;
66457 }
66458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66459         LDKDelayedPaymentOutputDescriptor arg_conv;
66460         arg_conv.inner = untag_ptr(arg);
66461         arg_conv.is_owned = ptr_is_owned(arg);
66462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66463         arg_conv.is_owned = false;
66464         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
66465         return ret_conv;
66466 }
66467
66468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66469         LDKDelayedPaymentOutputDescriptor orig_conv;
66470         orig_conv.inner = untag_ptr(orig);
66471         orig_conv.is_owned = ptr_is_owned(orig);
66472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66473         orig_conv.is_owned = false;
66474         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
66475         int64_t ret_ref = 0;
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66478         return ret_ref;
66479 }
66480
66481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
66482         LDKDelayedPaymentOutputDescriptor o_conv;
66483         o_conv.inner = untag_ptr(o);
66484         o_conv.is_owned = ptr_is_owned(o);
66485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66486         o_conv.is_owned = false;
66487         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
66488         return ret_conv;
66489 }
66490
66491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66492         LDKDelayedPaymentOutputDescriptor a_conv;
66493         a_conv.inner = untag_ptr(a);
66494         a_conv.is_owned = ptr_is_owned(a);
66495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66496         a_conv.is_owned = false;
66497         LDKDelayedPaymentOutputDescriptor b_conv;
66498         b_conv.inner = untag_ptr(b);
66499         b_conv.is_owned = ptr_is_owned(b);
66500         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66501         b_conv.is_owned = false;
66502         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
66503         return ret_conv;
66504 }
66505
66506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
66507         LDKDelayedPaymentOutputDescriptor obj_conv;
66508         obj_conv.inner = untag_ptr(obj);
66509         obj_conv.is_owned = ptr_is_owned(obj);
66510         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66511         obj_conv.is_owned = false;
66512         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
66513         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66514         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66515         CVec_u8Z_free(ret_var);
66516         return ret_arr;
66517 }
66518
66519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66520         LDKu8slice ser_ref;
66521         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66522         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66523         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
66524         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
66525         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66526         return tag_ptr(ret_conv, true);
66527 }
66528
66529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66530         LDKStaticPaymentOutputDescriptor this_obj_conv;
66531         this_obj_conv.inner = untag_ptr(this_obj);
66532         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66534         StaticPaymentOutputDescriptor_free(this_obj_conv);
66535 }
66536
66537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66538         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66539         this_ptr_conv.inner = untag_ptr(this_ptr);
66540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66542         this_ptr_conv.is_owned = false;
66543         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
66544         int64_t ret_ref = 0;
66545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66547         return ret_ref;
66548 }
66549
66550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66551         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66552         this_ptr_conv.inner = untag_ptr(this_ptr);
66553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66555         this_ptr_conv.is_owned = false;
66556         LDKOutPoint val_conv;
66557         val_conv.inner = untag_ptr(val);
66558         val_conv.is_owned = ptr_is_owned(val);
66559         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66560         val_conv = OutPoint_clone(&val_conv);
66561         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66562 }
66563
66564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66565         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66566         this_ptr_conv.inner = untag_ptr(this_ptr);
66567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66569         this_ptr_conv.is_owned = false;
66570         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66571         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
66572         return tag_ptr(ret_ref, true);
66573 }
66574
66575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66576         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66577         this_ptr_conv.inner = untag_ptr(this_ptr);
66578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66580         this_ptr_conv.is_owned = false;
66581         void* val_ptr = untag_ptr(val);
66582         CHECK_ACCESS(val_ptr);
66583         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66584         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66585         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
66586 }
66587
66588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
66589         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66590         this_ptr_conv.inner = untag_ptr(this_ptr);
66591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66593         this_ptr_conv.is_owned = false;
66594         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66595         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
66596         return ret_arr;
66597 }
66598
66599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66600         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66601         this_ptr_conv.inner = untag_ptr(this_ptr);
66602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66604         this_ptr_conv.is_owned = false;
66605         LDKThirtyTwoBytes val_ref;
66606         CHECK((*env)->GetArrayLength(env, val) == 32);
66607         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
66608         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
66609 }
66610
66611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
66612         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66613         this_ptr_conv.inner = untag_ptr(this_ptr);
66614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66616         this_ptr_conv.is_owned = false;
66617         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
66618         return ret_conv;
66619 }
66620
66621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66622         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66623         this_ptr_conv.inner = untag_ptr(this_ptr);
66624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66626         this_ptr_conv.is_owned = false;
66627         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
66628 }
66629
66630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
66631         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66632         this_ptr_conv.inner = untag_ptr(this_ptr);
66633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66635         this_ptr_conv.is_owned = false;
66636         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
66637         int64_t ret_ref = 0;
66638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66640         return ret_ref;
66641 }
66642
66643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66644         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66645         this_ptr_conv.inner = untag_ptr(this_ptr);
66646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66648         this_ptr_conv.is_owned = false;
66649         LDKChannelTransactionParameters val_conv;
66650         val_conv.inner = untag_ptr(val);
66651         val_conv.is_owned = ptr_is_owned(val);
66652         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66653         val_conv = ChannelTransactionParameters_clone(&val_conv);
66654         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
66655 }
66656
66657 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) {
66658         LDKOutPoint outpoint_arg_conv;
66659         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66660         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66661         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66662         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66663         void* output_arg_ptr = untag_ptr(output_arg);
66664         CHECK_ACCESS(output_arg_ptr);
66665         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66666         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66667         LDKThirtyTwoBytes channel_keys_id_arg_ref;
66668         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
66669         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
66670         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
66671         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
66672         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
66673         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
66674         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
66675         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);
66676         int64_t ret_ref = 0;
66677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66679         return ret_ref;
66680 }
66681
66682 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
66683         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
66684         int64_t ret_ref = 0;
66685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66687         return ret_ref;
66688 }
66689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66690         LDKStaticPaymentOutputDescriptor arg_conv;
66691         arg_conv.inner = untag_ptr(arg);
66692         arg_conv.is_owned = ptr_is_owned(arg);
66693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66694         arg_conv.is_owned = false;
66695         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
66696         return ret_conv;
66697 }
66698
66699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66700         LDKStaticPaymentOutputDescriptor orig_conv;
66701         orig_conv.inner = untag_ptr(orig);
66702         orig_conv.is_owned = ptr_is_owned(orig);
66703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66704         orig_conv.is_owned = false;
66705         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
66706         int64_t ret_ref = 0;
66707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66709         return ret_ref;
66710 }
66711
66712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
66713         LDKStaticPaymentOutputDescriptor o_conv;
66714         o_conv.inner = untag_ptr(o);
66715         o_conv.is_owned = ptr_is_owned(o);
66716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66717         o_conv.is_owned = false;
66718         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
66719         return ret_conv;
66720 }
66721
66722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66723         LDKStaticPaymentOutputDescriptor a_conv;
66724         a_conv.inner = untag_ptr(a);
66725         a_conv.is_owned = ptr_is_owned(a);
66726         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66727         a_conv.is_owned = false;
66728         LDKStaticPaymentOutputDescriptor b_conv;
66729         b_conv.inner = untag_ptr(b);
66730         b_conv.is_owned = ptr_is_owned(b);
66731         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66732         b_conv.is_owned = false;
66733         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
66734         return ret_conv;
66735 }
66736
66737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66738         LDKStaticPaymentOutputDescriptor this_arg_conv;
66739         this_arg_conv.inner = untag_ptr(this_arg);
66740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66742         this_arg_conv.is_owned = false;
66743         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66744         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
66745         int64_t ret_ref = tag_ptr(ret_copy, true);
66746         return ret_ref;
66747 }
66748
66749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
66750         LDKStaticPaymentOutputDescriptor this_arg_conv;
66751         this_arg_conv.inner = untag_ptr(this_arg);
66752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66754         this_arg_conv.is_owned = false;
66755         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
66756         return ret_conv;
66757 }
66758
66759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
66760         LDKStaticPaymentOutputDescriptor obj_conv;
66761         obj_conv.inner = untag_ptr(obj);
66762         obj_conv.is_owned = ptr_is_owned(obj);
66763         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66764         obj_conv.is_owned = false;
66765         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
66766         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66767         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66768         CVec_u8Z_free(ret_var);
66769         return ret_arr;
66770 }
66771
66772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66773         LDKu8slice ser_ref;
66774         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66775         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66776         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
66777         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
66778         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66779         return tag_ptr(ret_conv, true);
66780 }
66781
66782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66783         if (!ptr_is_owned(this_ptr)) return;
66784         void* this_ptr_ptr = untag_ptr(this_ptr);
66785         CHECK_ACCESS(this_ptr_ptr);
66786         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
66787         FREE(untag_ptr(this_ptr));
66788         SpendableOutputDescriptor_free(this_ptr_conv);
66789 }
66790
66791 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
66792         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66793         *ret_copy = SpendableOutputDescriptor_clone(arg);
66794         int64_t ret_ref = tag_ptr(ret_copy, true);
66795         return ret_ref;
66796 }
66797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66798         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
66799         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
66800         return ret_conv;
66801 }
66802
66803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66804         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
66805         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66806         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
66807         int64_t ret_ref = tag_ptr(ret_copy, true);
66808         return ret_ref;
66809 }
66810
66811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
66812         LDKOutPoint outpoint_conv;
66813         outpoint_conv.inner = untag_ptr(outpoint);
66814         outpoint_conv.is_owned = ptr_is_owned(outpoint);
66815         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
66816         outpoint_conv = OutPoint_clone(&outpoint_conv);
66817         void* output_ptr = untag_ptr(output);
66818         CHECK_ACCESS(output_ptr);
66819         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
66820         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
66821         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66822         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
66823         int64_t ret_ref = tag_ptr(ret_copy, true);
66824         return ret_ref;
66825 }
66826
66827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
66828         LDKDelayedPaymentOutputDescriptor a_conv;
66829         a_conv.inner = untag_ptr(a);
66830         a_conv.is_owned = ptr_is_owned(a);
66831         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66832         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
66833         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66834         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
66835         int64_t ret_ref = tag_ptr(ret_copy, true);
66836         return ret_ref;
66837 }
66838
66839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
66840         LDKStaticPaymentOutputDescriptor a_conv;
66841         a_conv.inner = untag_ptr(a);
66842         a_conv.is_owned = ptr_is_owned(a);
66843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66844         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
66845         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66846         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
66847         int64_t ret_ref = tag_ptr(ret_copy, true);
66848         return ret_ref;
66849 }
66850
66851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
66852         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
66853         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
66854         return ret_conv;
66855 }
66856
66857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66858         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
66859         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
66860         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
66861         return ret_conv;
66862 }
66863
66864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
66865         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
66866         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
66867         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66868         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66869         CVec_u8Z_free(ret_var);
66870         return ret_arr;
66871 }
66872
66873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66874         LDKu8slice ser_ref;
66875         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66876         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66877         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
66878         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
66879         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66880         return tag_ptr(ret_conv, true);
66881 }
66882
66883 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) {
66884         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
66885         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
66886         if (descriptors_constr.datalen > 0)
66887                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
66888         else
66889                 descriptors_constr.data = NULL;
66890         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
66891         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
66892                 int64_t descriptors_conv_27 = descriptors_vals[b];
66893                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
66894                 CHECK_ACCESS(descriptors_conv_27_ptr);
66895                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
66896                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
66897                 descriptors_constr.data[b] = descriptors_conv_27_conv;
66898         }
66899         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
66900         LDKCVec_TxOutZ outputs_constr;
66901         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
66902         if (outputs_constr.datalen > 0)
66903                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
66904         else
66905                 outputs_constr.data = NULL;
66906         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
66907         for (size_t h = 0; h < outputs_constr.datalen; h++) {
66908                 int64_t outputs_conv_7 = outputs_vals[h];
66909                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
66910                 CHECK_ACCESS(outputs_conv_7_ptr);
66911                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
66912                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
66913                 outputs_constr.data[h] = outputs_conv_7_conv;
66914         }
66915         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
66916         LDKCVec_u8Z change_destination_script_ref;
66917         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
66918         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
66919         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
66920         void* locktime_ptr = untag_ptr(locktime);
66921         CHECK_ACCESS(locktime_ptr);
66922         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
66923         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
66924         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
66925         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
66926         return tag_ptr(ret_conv, true);
66927 }
66928
66929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66930         if (!ptr_is_owned(this_ptr)) return;
66931         void* this_ptr_ptr = untag_ptr(this_ptr);
66932         CHECK_ACCESS(this_ptr_ptr);
66933         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
66934         FREE(untag_ptr(this_ptr));
66935         ChannelSigner_free(this_ptr_conv);
66936 }
66937
66938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66939         if (!ptr_is_owned(this_ptr)) return;
66940         void* this_ptr_ptr = untag_ptr(this_ptr);
66941         CHECK_ACCESS(this_ptr_ptr);
66942         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
66943         FREE(untag_ptr(this_ptr));
66944         EcdsaChannelSigner_free(this_ptr_conv);
66945 }
66946
66947 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
66948         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66949         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
66950         return tag_ptr(ret_ret, true);
66951 }
66952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66953         void* arg_ptr = untag_ptr(arg);
66954         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
66955         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
66956         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
66957         return ret_conv;
66958 }
66959
66960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66961         void* orig_ptr = untag_ptr(orig);
66962         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
66963         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
66964         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66965         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
66966         return tag_ptr(ret_ret, true);
66967 }
66968
66969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66970         if (!ptr_is_owned(this_ptr)) return;
66971         void* this_ptr_ptr = untag_ptr(this_ptr);
66972         CHECK_ACCESS(this_ptr_ptr);
66973         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
66974         FREE(untag_ptr(this_ptr));
66975         WriteableEcdsaChannelSigner_free(this_ptr_conv);
66976 }
66977
66978 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66979         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
66980         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
66981         return ret_conv;
66982 }
66983
66984 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
66985         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
66986         return ret_conv;
66987 }
66988
66989 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
66990         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
66991         return ret_conv;
66992 }
66993
66994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66995         if (!ptr_is_owned(this_ptr)) return;
66996         void* this_ptr_ptr = untag_ptr(this_ptr);
66997         CHECK_ACCESS(this_ptr_ptr);
66998         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
66999         FREE(untag_ptr(this_ptr));
67000         EntropySource_free(this_ptr_conv);
67001 }
67002
67003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67004         if (!ptr_is_owned(this_ptr)) return;
67005         void* this_ptr_ptr = untag_ptr(this_ptr);
67006         CHECK_ACCESS(this_ptr_ptr);
67007         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
67008         FREE(untag_ptr(this_ptr));
67009         NodeSigner_free(this_ptr_conv);
67010 }
67011
67012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67013         if (!ptr_is_owned(this_ptr)) return;
67014         void* this_ptr_ptr = untag_ptr(this_ptr);
67015         CHECK_ACCESS(this_ptr_ptr);
67016         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
67017         FREE(untag_ptr(this_ptr));
67018         SignerProvider_free(this_ptr_conv);
67019 }
67020
67021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67022         LDKInMemorySigner this_obj_conv;
67023         this_obj_conv.inner = untag_ptr(this_obj);
67024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67026         InMemorySigner_free(this_obj_conv);
67027 }
67028
67029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67030         LDKInMemorySigner this_ptr_conv;
67031         this_ptr_conv.inner = untag_ptr(this_ptr);
67032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67034         this_ptr_conv.is_owned = false;
67035         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67036         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
67037         return ret_arr;
67038 }
67039
67040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67041         LDKInMemorySigner this_ptr_conv;
67042         this_ptr_conv.inner = untag_ptr(this_ptr);
67043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67045         this_ptr_conv.is_owned = false;
67046         LDKSecretKey val_ref;
67047         CHECK((*env)->GetArrayLength(env, val) == 32);
67048         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67049         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
67050 }
67051
67052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67053         LDKInMemorySigner this_ptr_conv;
67054         this_ptr_conv.inner = untag_ptr(this_ptr);
67055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67057         this_ptr_conv.is_owned = false;
67058         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67059         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
67060         return ret_arr;
67061 }
67062
67063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67064         LDKInMemorySigner this_ptr_conv;
67065         this_ptr_conv.inner = untag_ptr(this_ptr);
67066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67068         this_ptr_conv.is_owned = false;
67069         LDKSecretKey val_ref;
67070         CHECK((*env)->GetArrayLength(env, val) == 32);
67071         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67072         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
67073 }
67074
67075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67076         LDKInMemorySigner this_ptr_conv;
67077         this_ptr_conv.inner = untag_ptr(this_ptr);
67078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67080         this_ptr_conv.is_owned = false;
67081         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67082         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
67083         return ret_arr;
67084 }
67085
67086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67087         LDKInMemorySigner this_ptr_conv;
67088         this_ptr_conv.inner = untag_ptr(this_ptr);
67089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67091         this_ptr_conv.is_owned = false;
67092         LDKSecretKey val_ref;
67093         CHECK((*env)->GetArrayLength(env, val) == 32);
67094         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67095         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
67096 }
67097
67098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67099         LDKInMemorySigner this_ptr_conv;
67100         this_ptr_conv.inner = untag_ptr(this_ptr);
67101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67103         this_ptr_conv.is_owned = false;
67104         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67105         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
67106         return ret_arr;
67107 }
67108
67109 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) {
67110         LDKInMemorySigner this_ptr_conv;
67111         this_ptr_conv.inner = untag_ptr(this_ptr);
67112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67114         this_ptr_conv.is_owned = false;
67115         LDKSecretKey val_ref;
67116         CHECK((*env)->GetArrayLength(env, val) == 32);
67117         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67118         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
67119 }
67120
67121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67122         LDKInMemorySigner this_ptr_conv;
67123         this_ptr_conv.inner = untag_ptr(this_ptr);
67124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67126         this_ptr_conv.is_owned = false;
67127         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67128         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
67129         return ret_arr;
67130 }
67131
67132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67133         LDKInMemorySigner this_ptr_conv;
67134         this_ptr_conv.inner = untag_ptr(this_ptr);
67135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67137         this_ptr_conv.is_owned = false;
67138         LDKSecretKey val_ref;
67139         CHECK((*env)->GetArrayLength(env, val) == 32);
67140         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67141         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
67142 }
67143
67144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
67145         LDKInMemorySigner this_ptr_conv;
67146         this_ptr_conv.inner = untag_ptr(this_ptr);
67147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67149         this_ptr_conv.is_owned = false;
67150         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67151         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
67152         return ret_arr;
67153 }
67154
67155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67156         LDKInMemorySigner this_ptr_conv;
67157         this_ptr_conv.inner = untag_ptr(this_ptr);
67158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67160         this_ptr_conv.is_owned = false;
67161         LDKThirtyTwoBytes val_ref;
67162         CHECK((*env)->GetArrayLength(env, val) == 32);
67163         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67164         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
67165 }
67166
67167 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
67168         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
67169         int64_t ret_ref = 0;
67170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67172         return ret_ref;
67173 }
67174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67175         LDKInMemorySigner arg_conv;
67176         arg_conv.inner = untag_ptr(arg);
67177         arg_conv.is_owned = ptr_is_owned(arg);
67178         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67179         arg_conv.is_owned = false;
67180         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
67181         return ret_conv;
67182 }
67183
67184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67185         LDKInMemorySigner orig_conv;
67186         orig_conv.inner = untag_ptr(orig);
67187         orig_conv.is_owned = ptr_is_owned(orig);
67188         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67189         orig_conv.is_owned = false;
67190         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
67191         int64_t ret_ref = 0;
67192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67194         return ret_ref;
67195 }
67196
67197 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) {
67198         LDKSecretKey funding_key_ref;
67199         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
67200         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
67201         LDKSecretKey revocation_base_key_ref;
67202         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
67203         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
67204         LDKSecretKey payment_key_ref;
67205         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
67206         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
67207         LDKSecretKey delayed_payment_base_key_ref;
67208         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
67209         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
67210         LDKSecretKey htlc_base_key_ref;
67211         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
67212         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
67213         LDKThirtyTwoBytes commitment_seed_ref;
67214         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
67215         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
67216         LDKThirtyTwoBytes channel_keys_id_ref;
67217         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
67218         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
67219         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
67220         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
67221         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
67222         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);
67223         int64_t ret_ref = 0;
67224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67226         return ret_ref;
67227 }
67228
67229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
67230         LDKInMemorySigner this_arg_conv;
67231         this_arg_conv.inner = untag_ptr(this_arg);
67232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67234         this_arg_conv.is_owned = false;
67235         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
67236         int64_t ret_ref = 0;
67237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67239         return ret_ref;
67240 }
67241
67242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
67243         LDKInMemorySigner this_arg_conv;
67244         this_arg_conv.inner = untag_ptr(this_arg);
67245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67247         this_arg_conv.is_owned = false;
67248         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
67249         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
67250         int64_t ret_ref = tag_ptr(ret_copy, true);
67251         return ret_ref;
67252 }
67253
67254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
67255         LDKInMemorySigner this_arg_conv;
67256         this_arg_conv.inner = untag_ptr(this_arg);
67257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67259         this_arg_conv.is_owned = false;
67260         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
67261         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
67262         int64_t ret_ref = tag_ptr(ret_copy, true);
67263         return ret_ref;
67264 }
67265
67266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
67267         LDKInMemorySigner this_arg_conv;
67268         this_arg_conv.inner = untag_ptr(this_arg);
67269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67271         this_arg_conv.is_owned = false;
67272         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
67273         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
67274         int64_t ret_ref = tag_ptr(ret_copy, true);
67275         return ret_ref;
67276 }
67277
67278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
67279         LDKInMemorySigner this_arg_conv;
67280         this_arg_conv.inner = untag_ptr(this_arg);
67281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67283         this_arg_conv.is_owned = false;
67284         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
67285         int64_t ret_ref = 0;
67286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67288         return ret_ref;
67289 }
67290
67291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
67292         LDKInMemorySigner this_arg_conv;
67293         this_arg_conv.inner = untag_ptr(this_arg);
67294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67296         this_arg_conv.is_owned = false;
67297         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
67298         int64_t ret_ref = 0;
67299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67301         return ret_ref;
67302 }
67303
67304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
67305         LDKInMemorySigner this_arg_conv;
67306         this_arg_conv.inner = untag_ptr(this_arg);
67307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67309         this_arg_conv.is_owned = false;
67310         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
67311         int64_t ret_ref = 0;
67312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67314         return ret_ref;
67315 }
67316
67317 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) {
67318         LDKInMemorySigner this_arg_conv;
67319         this_arg_conv.inner = untag_ptr(this_arg);
67320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67322         this_arg_conv.is_owned = false;
67323         LDKTransaction spend_tx_ref;
67324         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
67325         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
67326         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
67327         spend_tx_ref.data_is_owned = true;
67328         LDKStaticPaymentOutputDescriptor descriptor_conv;
67329         descriptor_conv.inner = untag_ptr(descriptor);
67330         descriptor_conv.is_owned = ptr_is_owned(descriptor);
67331         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
67332         descriptor_conv.is_owned = false;
67333         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
67334         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
67335         return tag_ptr(ret_conv, true);
67336 }
67337
67338 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) {
67339         LDKInMemorySigner this_arg_conv;
67340         this_arg_conv.inner = untag_ptr(this_arg);
67341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67343         this_arg_conv.is_owned = false;
67344         LDKTransaction spend_tx_ref;
67345         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
67346         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
67347         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
67348         spend_tx_ref.data_is_owned = true;
67349         LDKDelayedPaymentOutputDescriptor descriptor_conv;
67350         descriptor_conv.inner = untag_ptr(descriptor);
67351         descriptor_conv.is_owned = ptr_is_owned(descriptor);
67352         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
67353         descriptor_conv.is_owned = false;
67354         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
67355         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
67356         return tag_ptr(ret_conv, true);
67357 }
67358
67359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
67360         LDKInMemorySigner this_arg_conv;
67361         this_arg_conv.inner = untag_ptr(this_arg);
67362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67364         this_arg_conv.is_owned = false;
67365         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
67366         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
67367         return tag_ptr(ret_ret, true);
67368 }
67369
67370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67371         LDKInMemorySigner this_arg_conv;
67372         this_arg_conv.inner = untag_ptr(this_arg);
67373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67375         this_arg_conv.is_owned = false;
67376         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
67377         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
67378         return tag_ptr(ret_ret, true);
67379 }
67380
67381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67382         LDKInMemorySigner this_arg_conv;
67383         this_arg_conv.inner = untag_ptr(this_arg);
67384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67386         this_arg_conv.is_owned = false;
67387         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
67388         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
67389         return tag_ptr(ret_ret, true);
67390 }
67391
67392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67393         LDKInMemorySigner this_arg_conv;
67394         this_arg_conv.inner = untag_ptr(this_arg);
67395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67397         this_arg_conv.is_owned = false;
67398         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
67399         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
67400         return tag_ptr(ret_ret, true);
67401 }
67402
67403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
67404         LDKInMemorySigner obj_conv;
67405         obj_conv.inner = untag_ptr(obj);
67406         obj_conv.is_owned = ptr_is_owned(obj);
67407         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67408         obj_conv.is_owned = false;
67409         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
67410         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67411         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67412         CVec_u8Z_free(ret_var);
67413         return ret_arr;
67414 }
67415
67416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
67417         LDKu8slice ser_ref;
67418         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67419         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67420         void* arg_ptr = untag_ptr(arg);
67421         CHECK_ACCESS(arg_ptr);
67422         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
67423         if (arg_conv.free == LDKEntropySource_JCalls_free) {
67424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67425                 LDKEntropySource_JCalls_cloned(&arg_conv);
67426         }
67427         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
67428         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
67429         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67430         return tag_ptr(ret_conv, true);
67431 }
67432
67433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67434         LDKKeysManager 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         KeysManager_free(this_obj_conv);
67439 }
67440
67441 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) {
67442         uint8_t seed_arr[32];
67443         CHECK((*env)->GetArrayLength(env, seed) == 32);
67444         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
67445         uint8_t (*seed_ref)[32] = &seed_arr;
67446         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
67447         int64_t ret_ref = 0;
67448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67450         return ret_ref;
67451 }
67452
67453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
67454         LDKKeysManager this_arg_conv;
67455         this_arg_conv.inner = untag_ptr(this_arg);
67456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67458         this_arg_conv.is_owned = false;
67459         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67460         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
67461         return ret_arr;
67462 }
67463
67464 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) {
67465         LDKKeysManager this_arg_conv;
67466         this_arg_conv.inner = untag_ptr(this_arg);
67467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67469         this_arg_conv.is_owned = false;
67470         uint8_t params_arr[32];
67471         CHECK((*env)->GetArrayLength(env, params) == 32);
67472         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
67473         uint8_t (*params_ref)[32] = &params_arr;
67474         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
67475         int64_t ret_ref = 0;
67476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67478         return ret_ref;
67479 }
67480
67481 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) {
67482         LDKKeysManager this_arg_conv;
67483         this_arg_conv.inner = untag_ptr(this_arg);
67484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67486         this_arg_conv.is_owned = false;
67487         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67488         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67489         if (descriptors_constr.datalen > 0)
67490                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67491         else
67492                 descriptors_constr.data = NULL;
67493         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67494         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67495                 int64_t descriptors_conv_27 = descriptors_vals[b];
67496                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67497                 CHECK_ACCESS(descriptors_conv_27_ptr);
67498                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67499                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67500                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67501         }
67502         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67503         LDKCVec_u8Z psbt_ref;
67504         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
67505         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
67506         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
67507         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
67508         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
67509         return tag_ptr(ret_conv, true);
67510 }
67511
67512 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) {
67513         LDKKeysManager this_arg_conv;
67514         this_arg_conv.inner = untag_ptr(this_arg);
67515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67517         this_arg_conv.is_owned = false;
67518         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67519         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67520         if (descriptors_constr.datalen > 0)
67521                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67522         else
67523                 descriptors_constr.data = NULL;
67524         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67525         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67526                 int64_t descriptors_conv_27 = descriptors_vals[b];
67527                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67528                 CHECK_ACCESS(descriptors_conv_27_ptr);
67529                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67530                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67531                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67532         }
67533         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67534         LDKCVec_TxOutZ outputs_constr;
67535         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
67536         if (outputs_constr.datalen > 0)
67537                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
67538         else
67539                 outputs_constr.data = NULL;
67540         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
67541         for (size_t h = 0; h < outputs_constr.datalen; h++) {
67542                 int64_t outputs_conv_7 = outputs_vals[h];
67543                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
67544                 CHECK_ACCESS(outputs_conv_7_ptr);
67545                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
67546                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
67547                 outputs_constr.data[h] = outputs_conv_7_conv;
67548         }
67549         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
67550         LDKCVec_u8Z change_destination_script_ref;
67551         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
67552         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
67553         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
67554         void* locktime_ptr = untag_ptr(locktime);
67555         CHECK_ACCESS(locktime_ptr);
67556         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
67557         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
67558         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
67559         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
67560         return tag_ptr(ret_conv, true);
67561 }
67562
67563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
67564         LDKKeysManager this_arg_conv;
67565         this_arg_conv.inner = untag_ptr(this_arg);
67566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67568         this_arg_conv.is_owned = false;
67569         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
67570         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
67571         return tag_ptr(ret_ret, true);
67572 }
67573
67574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67575         LDKKeysManager this_arg_conv;
67576         this_arg_conv.inner = untag_ptr(this_arg);
67577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67579         this_arg_conv.is_owned = false;
67580         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
67581         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
67582         return tag_ptr(ret_ret, true);
67583 }
67584
67585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
67586         LDKKeysManager this_arg_conv;
67587         this_arg_conv.inner = untag_ptr(this_arg);
67588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67590         this_arg_conv.is_owned = false;
67591         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
67592         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
67593         return tag_ptr(ret_ret, true);
67594 }
67595
67596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67597         LDKPhantomKeysManager this_obj_conv;
67598         this_obj_conv.inner = untag_ptr(this_obj);
67599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67601         PhantomKeysManager_free(this_obj_conv);
67602 }
67603
67604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
67605         LDKPhantomKeysManager this_arg_conv;
67606         this_arg_conv.inner = untag_ptr(this_arg);
67607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67609         this_arg_conv.is_owned = false;
67610         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
67611         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
67612         return tag_ptr(ret_ret, true);
67613 }
67614
67615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67616         LDKPhantomKeysManager this_arg_conv;
67617         this_arg_conv.inner = untag_ptr(this_arg);
67618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67620         this_arg_conv.is_owned = false;
67621         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
67622         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
67623         return tag_ptr(ret_ret, true);
67624 }
67625
67626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
67627         LDKPhantomKeysManager this_arg_conv;
67628         this_arg_conv.inner = untag_ptr(this_arg);
67629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67631         this_arg_conv.is_owned = false;
67632         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
67633         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
67634         return tag_ptr(ret_ret, true);
67635 }
67636
67637 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) {
67638         uint8_t seed_arr[32];
67639         CHECK((*env)->GetArrayLength(env, seed) == 32);
67640         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
67641         uint8_t (*seed_ref)[32] = &seed_arr;
67642         uint8_t cross_node_seed_arr[32];
67643         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
67644         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
67645         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
67646         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
67647         int64_t ret_ref = 0;
67648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67650         return ret_ref;
67651 }
67652
67653 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) {
67654         LDKPhantomKeysManager this_arg_conv;
67655         this_arg_conv.inner = untag_ptr(this_arg);
67656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67658         this_arg_conv.is_owned = false;
67659         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67660         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67661         if (descriptors_constr.datalen > 0)
67662                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67663         else
67664                 descriptors_constr.data = NULL;
67665         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67666         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67667                 int64_t descriptors_conv_27 = descriptors_vals[b];
67668                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67669                 CHECK_ACCESS(descriptors_conv_27_ptr);
67670                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67671                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67672                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67673         }
67674         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67675         LDKCVec_TxOutZ outputs_constr;
67676         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
67677         if (outputs_constr.datalen > 0)
67678                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
67679         else
67680                 outputs_constr.data = NULL;
67681         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
67682         for (size_t h = 0; h < outputs_constr.datalen; h++) {
67683                 int64_t outputs_conv_7 = outputs_vals[h];
67684                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
67685                 CHECK_ACCESS(outputs_conv_7_ptr);
67686                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
67687                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
67688                 outputs_constr.data[h] = outputs_conv_7_conv;
67689         }
67690         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
67691         LDKCVec_u8Z change_destination_script_ref;
67692         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
67693         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
67694         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
67695         void* locktime_ptr = untag_ptr(locktime);
67696         CHECK_ACCESS(locktime_ptr);
67697         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
67698         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
67699         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
67700         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
67701         return tag_ptr(ret_conv, true);
67702 }
67703
67704 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) {
67705         LDKPhantomKeysManager this_arg_conv;
67706         this_arg_conv.inner = untag_ptr(this_arg);
67707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67709         this_arg_conv.is_owned = false;
67710         uint8_t params_arr[32];
67711         CHECK((*env)->GetArrayLength(env, params) == 32);
67712         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
67713         uint8_t (*params_ref)[32] = &params_arr;
67714         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
67715         int64_t ret_ref = 0;
67716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67718         return ret_ref;
67719 }
67720
67721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
67722         LDKPhantomKeysManager this_arg_conv;
67723         this_arg_conv.inner = untag_ptr(this_arg);
67724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67726         this_arg_conv.is_owned = false;
67727         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67728         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
67729         return ret_arr;
67730 }
67731
67732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
67733         LDKPhantomKeysManager this_arg_conv;
67734         this_arg_conv.inner = untag_ptr(this_arg);
67735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67737         this_arg_conv.is_owned = false;
67738         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67739         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
67740         return ret_arr;
67741 }
67742
67743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67744         LDKOnionMessenger this_obj_conv;
67745         this_obj_conv.inner = untag_ptr(this_obj);
67746         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67748         OnionMessenger_free(this_obj_conv);
67749 }
67750
67751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67752         if (!ptr_is_owned(this_ptr)) return;
67753         void* this_ptr_ptr = untag_ptr(this_ptr);
67754         CHECK_ACCESS(this_ptr_ptr);
67755         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
67756         FREE(untag_ptr(this_ptr));
67757         MessageRouter_free(this_ptr_conv);
67758 }
67759
67760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67761         LDKDefaultMessageRouter this_obj_conv;
67762         this_obj_conv.inner = untag_ptr(this_obj);
67763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67765         DefaultMessageRouter_free(this_obj_conv);
67766 }
67767
67768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz) {
67769         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
67770         int64_t ret_ref = 0;
67771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67773         return ret_ref;
67774 }
67775
67776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
67777         LDKDefaultMessageRouter this_arg_conv;
67778         this_arg_conv.inner = untag_ptr(this_arg);
67779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67781         this_arg_conv.is_owned = false;
67782         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
67783         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
67784         return tag_ptr(ret_ret, true);
67785 }
67786
67787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67788         LDKOnionMessagePath this_obj_conv;
67789         this_obj_conv.inner = untag_ptr(this_obj);
67790         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67792         OnionMessagePath_free(this_obj_conv);
67793 }
67794
67795 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
67796         LDKOnionMessagePath this_ptr_conv;
67797         this_ptr_conv.inner = untag_ptr(this_ptr);
67798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67800         this_ptr_conv.is_owned = false;
67801         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
67802         jobjectArray ret_arr = NULL;
67803         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
67804         ;
67805         for (size_t i = 0; i < ret_var.datalen; i++) {
67806                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
67807                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
67808                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
67809         }
67810         
67811         FREE(ret_var.data);
67812         return ret_arr;
67813 }
67814
67815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
67816         LDKOnionMessagePath this_ptr_conv;
67817         this_ptr_conv.inner = untag_ptr(this_ptr);
67818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67820         this_ptr_conv.is_owned = false;
67821         LDKCVec_PublicKeyZ val_constr;
67822         val_constr.datalen = (*env)->GetArrayLength(env, val);
67823         if (val_constr.datalen > 0)
67824                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
67825         else
67826                 val_constr.data = NULL;
67827         for (size_t i = 0; i < val_constr.datalen; i++) {
67828                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
67829                 LDKPublicKey val_conv_8_ref;
67830                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
67831                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
67832                 val_constr.data[i] = val_conv_8_ref;
67833         }
67834         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
67835 }
67836
67837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
67838         LDKOnionMessagePath this_ptr_conv;
67839         this_ptr_conv.inner = untag_ptr(this_ptr);
67840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67842         this_ptr_conv.is_owned = false;
67843         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67844         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
67845         int64_t ret_ref = tag_ptr(ret_copy, true);
67846         return ret_ref;
67847 }
67848
67849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67850         LDKOnionMessagePath this_ptr_conv;
67851         this_ptr_conv.inner = untag_ptr(this_ptr);
67852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67854         this_ptr_conv.is_owned = false;
67855         void* val_ptr = untag_ptr(val);
67856         CHECK_ACCESS(val_ptr);
67857         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
67858         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
67859         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
67860 }
67861
67862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg) {
67863         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
67864         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
67865         if (intermediate_nodes_arg_constr.datalen > 0)
67866                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
67867         else
67868                 intermediate_nodes_arg_constr.data = NULL;
67869         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
67870                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
67871                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
67872                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
67873                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
67874                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
67875         }
67876         void* destination_arg_ptr = untag_ptr(destination_arg);
67877         CHECK_ACCESS(destination_arg_ptr);
67878         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
67879         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
67880         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
67881         int64_t ret_ref = 0;
67882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67884         return ret_ref;
67885 }
67886
67887 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
67888         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
67889         int64_t ret_ref = 0;
67890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67892         return ret_ref;
67893 }
67894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67895         LDKOnionMessagePath arg_conv;
67896         arg_conv.inner = untag_ptr(arg);
67897         arg_conv.is_owned = ptr_is_owned(arg);
67898         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67899         arg_conv.is_owned = false;
67900         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
67901         return ret_conv;
67902 }
67903
67904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67905         LDKOnionMessagePath orig_conv;
67906         orig_conv.inner = untag_ptr(orig);
67907         orig_conv.is_owned = ptr_is_owned(orig);
67908         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67909         orig_conv.is_owned = false;
67910         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
67911         int64_t ret_ref = 0;
67912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67914         return ret_ref;
67915 }
67916
67917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67918         if (!ptr_is_owned(this_ptr)) return;
67919         void* this_ptr_ptr = untag_ptr(this_ptr);
67920         CHECK_ACCESS(this_ptr_ptr);
67921         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
67922         FREE(untag_ptr(this_ptr));
67923         Destination_free(this_ptr_conv);
67924 }
67925
67926 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
67927         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67928         *ret_copy = Destination_clone(arg);
67929         int64_t ret_ref = tag_ptr(ret_copy, true);
67930         return ret_ref;
67931 }
67932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67933         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
67934         int64_t ret_conv = Destination_clone_ptr(arg_conv);
67935         return ret_conv;
67936 }
67937
67938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67939         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
67940         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67941         *ret_copy = Destination_clone(orig_conv);
67942         int64_t ret_ref = tag_ptr(ret_copy, true);
67943         return ret_ref;
67944 }
67945
67946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
67947         LDKPublicKey a_ref;
67948         CHECK((*env)->GetArrayLength(env, a) == 33);
67949         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
67950         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67951         *ret_copy = Destination_node(a_ref);
67952         int64_t ret_ref = tag_ptr(ret_copy, true);
67953         return ret_ref;
67954 }
67955
67956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
67957         LDKBlindedPath a_conv;
67958         a_conv.inner = untag_ptr(a);
67959         a_conv.is_owned = ptr_is_owned(a);
67960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67961         a_conv = BlindedPath_clone(&a_conv);
67962         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67963         *ret_copy = Destination_blinded_path(a_conv);
67964         int64_t ret_ref = tag_ptr(ret_copy, true);
67965         return ret_ref;
67966 }
67967
67968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67969         if (!ptr_is_owned(this_ptr)) return;
67970         void* this_ptr_ptr = untag_ptr(this_ptr);
67971         CHECK_ACCESS(this_ptr_ptr);
67972         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
67973         FREE(untag_ptr(this_ptr));
67974         SendError_free(this_ptr_conv);
67975 }
67976
67977 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
67978         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
67979         *ret_copy = SendError_clone(arg);
67980         int64_t ret_ref = tag_ptr(ret_copy, true);
67981         return ret_ref;
67982 }
67983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67984         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
67985         int64_t ret_conv = SendError_clone_ptr(arg_conv);
67986         return ret_conv;
67987 }
67988
67989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67990         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
67991         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
67992         *ret_copy = SendError_clone(orig_conv);
67993         int64_t ret_ref = tag_ptr(ret_copy, true);
67994         return ret_ref;
67995 }
67996
67997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
67998         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
67999         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68000         *ret_copy = SendError_secp256k1(a_conv);
68001         int64_t ret_ref = tag_ptr(ret_copy, true);
68002         return ret_ref;
68003 }
68004
68005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
68006         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68007         *ret_copy = SendError_too_big_packet();
68008         int64_t ret_ref = tag_ptr(ret_copy, true);
68009         return ret_ref;
68010 }
68011
68012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
68013         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68014         *ret_copy = SendError_too_few_blinded_hops();
68015         int64_t ret_ref = tag_ptr(ret_copy, true);
68016         return ret_ref;
68017 }
68018
68019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
68020         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68021         *ret_copy = SendError_invalid_first_hop();
68022         int64_t ret_ref = tag_ptr(ret_copy, true);
68023         return ret_ref;
68024 }
68025
68026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
68027         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68028         *ret_copy = SendError_invalid_message();
68029         int64_t ret_ref = tag_ptr(ret_copy, true);
68030         return ret_ref;
68031 }
68032
68033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
68034         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68035         *ret_copy = SendError_buffer_full();
68036         int64_t ret_ref = tag_ptr(ret_copy, true);
68037         return ret_ref;
68038 }
68039
68040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
68041         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68042         *ret_copy = SendError_get_node_id_failed();
68043         int64_t ret_ref = tag_ptr(ret_copy, true);
68044         return ret_ref;
68045 }
68046
68047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
68048         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68049         *ret_copy = SendError_blinded_path_advance_failed();
68050         int64_t ret_ref = tag_ptr(ret_copy, true);
68051         return ret_ref;
68052 }
68053
68054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68055         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
68056         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
68057         jboolean ret_conv = SendError_eq(a_conv, b_conv);
68058         return ret_conv;
68059 }
68060
68061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68062         if (!ptr_is_owned(this_ptr)) return;
68063         void* this_ptr_ptr = untag_ptr(this_ptr);
68064         CHECK_ACCESS(this_ptr_ptr);
68065         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
68066         FREE(untag_ptr(this_ptr));
68067         CustomOnionMessageHandler_free(this_ptr_conv);
68068 }
68069
68070 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 message, int64_t reply_path) {
68071         void* entropy_source_ptr = untag_ptr(entropy_source);
68072         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68073         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68074         void* node_signer_ptr = untag_ptr(node_signer);
68075         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
68076         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
68077         LDKOnionMessagePath path_conv;
68078         path_conv.inner = untag_ptr(path);
68079         path_conv.is_owned = ptr_is_owned(path);
68080         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
68081         path_conv = OnionMessagePath_clone(&path_conv);
68082         void* message_ptr = untag_ptr(message);
68083         CHECK_ACCESS(message_ptr);
68084         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
68085         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
68086         LDKBlindedPath reply_path_conv;
68087         reply_path_conv.inner = untag_ptr(reply_path);
68088         reply_path_conv.is_owned = ptr_is_owned(reply_path);
68089         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
68090         reply_path_conv = BlindedPath_clone(&reply_path_conv);
68091         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
68092         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, message_conv, reply_path_conv);
68093         return tag_ptr(ret_conv, true);
68094 }
68095
68096 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) {
68097         void* entropy_source_ptr = untag_ptr(entropy_source);
68098         CHECK_ACCESS(entropy_source_ptr);
68099         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
68100         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
68101                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68102                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
68103         }
68104         void* node_signer_ptr = untag_ptr(node_signer);
68105         CHECK_ACCESS(node_signer_ptr);
68106         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
68107         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
68108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68109                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
68110         }
68111         void* logger_ptr = untag_ptr(logger);
68112         CHECK_ACCESS(logger_ptr);
68113         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
68114         if (logger_conv.free == LDKLogger_JCalls_free) {
68115                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68116                 LDKLogger_JCalls_cloned(&logger_conv);
68117         }
68118         void* message_router_ptr = untag_ptr(message_router);
68119         CHECK_ACCESS(message_router_ptr);
68120         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
68121         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
68122                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68123                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
68124         }
68125         void* offers_handler_ptr = untag_ptr(offers_handler);
68126         CHECK_ACCESS(offers_handler_ptr);
68127         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
68128         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
68129                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68130                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
68131         }
68132         void* custom_handler_ptr = untag_ptr(custom_handler);
68133         CHECK_ACCESS(custom_handler_ptr);
68134         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
68135         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
68136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68137                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
68138         }
68139         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
68140         int64_t ret_ref = 0;
68141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68143         return ret_ref;
68144 }
68145
68146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t message, int64_t reply_path) {
68147         LDKOnionMessenger this_arg_conv;
68148         this_arg_conv.inner = untag_ptr(this_arg);
68149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68151         this_arg_conv.is_owned = false;
68152         LDKOnionMessagePath path_conv;
68153         path_conv.inner = untag_ptr(path);
68154         path_conv.is_owned = ptr_is_owned(path);
68155         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
68156         path_conv = OnionMessagePath_clone(&path_conv);
68157         void* message_ptr = untag_ptr(message);
68158         CHECK_ACCESS(message_ptr);
68159         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
68160         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
68161         LDKBlindedPath reply_path_conv;
68162         reply_path_conv.inner = untag_ptr(reply_path);
68163         reply_path_conv.is_owned = ptr_is_owned(reply_path);
68164         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
68165         reply_path_conv = BlindedPath_clone(&reply_path_conv);
68166         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
68167         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
68168         return tag_ptr(ret_conv, true);
68169 }
68170
68171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
68172         LDKOnionMessenger this_arg_conv;
68173         this_arg_conv.inner = untag_ptr(this_arg);
68174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68176         this_arg_conv.is_owned = false;
68177         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
68178         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
68179         return tag_ptr(ret_ret, true);
68180 }
68181
68182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
68183         LDKOnionMessenger this_arg_conv;
68184         this_arg_conv.inner = untag_ptr(this_arg);
68185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68187         this_arg_conv.is_owned = false;
68188         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
68189         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
68190         return tag_ptr(ret_ret, true);
68191 }
68192
68193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68194         if (!ptr_is_owned(this_ptr)) return;
68195         void* this_ptr_ptr = untag_ptr(this_ptr);
68196         CHECK_ACCESS(this_ptr_ptr);
68197         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
68198         FREE(untag_ptr(this_ptr));
68199         OffersMessageHandler_free(this_ptr_conv);
68200 }
68201
68202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68203         if (!ptr_is_owned(this_ptr)) return;
68204         void* this_ptr_ptr = untag_ptr(this_ptr);
68205         CHECK_ACCESS(this_ptr_ptr);
68206         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
68207         FREE(untag_ptr(this_ptr));
68208         OffersMessage_free(this_ptr_conv);
68209 }
68210
68211 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
68212         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68213         *ret_copy = OffersMessage_clone(arg);
68214         int64_t ret_ref = tag_ptr(ret_copy, true);
68215         return ret_ref;
68216 }
68217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68218         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
68219         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
68220         return ret_conv;
68221 }
68222
68223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68224         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
68225         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68226         *ret_copy = OffersMessage_clone(orig_conv);
68227         int64_t ret_ref = tag_ptr(ret_copy, true);
68228         return ret_ref;
68229 }
68230
68231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
68232         LDKInvoiceRequest a_conv;
68233         a_conv.inner = untag_ptr(a);
68234         a_conv.is_owned = ptr_is_owned(a);
68235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68236         a_conv = InvoiceRequest_clone(&a_conv);
68237         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68238         *ret_copy = OffersMessage_invoice_request(a_conv);
68239         int64_t ret_ref = tag_ptr(ret_copy, true);
68240         return ret_ref;
68241 }
68242
68243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
68244         LDKBolt12Invoice a_conv;
68245         a_conv.inner = untag_ptr(a);
68246         a_conv.is_owned = ptr_is_owned(a);
68247         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68248         a_conv = Bolt12Invoice_clone(&a_conv);
68249         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68250         *ret_copy = OffersMessage_invoice(a_conv);
68251         int64_t ret_ref = tag_ptr(ret_copy, true);
68252         return ret_ref;
68253 }
68254
68255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
68256         LDKInvoiceError a_conv;
68257         a_conv.inner = untag_ptr(a);
68258         a_conv.is_owned = ptr_is_owned(a);
68259         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68260         a_conv = InvoiceError_clone(&a_conv);
68261         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68262         *ret_copy = OffersMessage_invoice_error(a_conv);
68263         int64_t ret_ref = tag_ptr(ret_copy, true);
68264         return ret_ref;
68265 }
68266
68267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
68268         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
68269         return ret_conv;
68270 }
68271
68272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
68273         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
68274         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
68275         return ret_conv;
68276 }
68277
68278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
68279         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
68280         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
68281         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68282         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68283         CVec_u8Z_free(ret_var);
68284         return ret_arr;
68285 }
68286
68287 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) {
68288         LDKu8slice ser_ref;
68289         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68290         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68291         void* arg_b_ptr = untag_ptr(arg_b);
68292         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
68293         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
68294         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
68295         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
68296         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68297         return tag_ptr(ret_conv, true);
68298 }
68299
68300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68301         LDKPacket this_obj_conv;
68302         this_obj_conv.inner = untag_ptr(this_obj);
68303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68305         Packet_free(this_obj_conv);
68306 }
68307
68308 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
68309         LDKPacket this_ptr_conv;
68310         this_ptr_conv.inner = untag_ptr(this_ptr);
68311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68313         this_ptr_conv.is_owned = false;
68314         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
68315         return ret_conv;
68316 }
68317
68318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
68319         LDKPacket this_ptr_conv;
68320         this_ptr_conv.inner = untag_ptr(this_ptr);
68321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68323         this_ptr_conv.is_owned = false;
68324         Packet_set_version(&this_ptr_conv, val);
68325 }
68326
68327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68328         LDKPacket this_ptr_conv;
68329         this_ptr_conv.inner = untag_ptr(this_ptr);
68330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68332         this_ptr_conv.is_owned = false;
68333         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
68335         return ret_arr;
68336 }
68337
68338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68339         LDKPacket this_ptr_conv;
68340         this_ptr_conv.inner = untag_ptr(this_ptr);
68341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68343         this_ptr_conv.is_owned = false;
68344         LDKPublicKey val_ref;
68345         CHECK((*env)->GetArrayLength(env, val) == 33);
68346         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68347         Packet_set_public_key(&this_ptr_conv, val_ref);
68348 }
68349
68350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
68351         LDKPacket this_ptr_conv;
68352         this_ptr_conv.inner = untag_ptr(this_ptr);
68353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68355         this_ptr_conv.is_owned = false;
68356         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
68357         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68358         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68359         CVec_u8Z_free(ret_var);
68360         return ret_arr;
68361 }
68362
68363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68364         LDKPacket this_ptr_conv;
68365         this_ptr_conv.inner = untag_ptr(this_ptr);
68366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68368         this_ptr_conv.is_owned = false;
68369         LDKCVec_u8Z val_ref;
68370         val_ref.datalen = (*env)->GetArrayLength(env, val);
68371         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
68372         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
68373         Packet_set_hop_data(&this_ptr_conv, val_ref);
68374 }
68375
68376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
68377         LDKPacket this_ptr_conv;
68378         this_ptr_conv.inner = untag_ptr(this_ptr);
68379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68381         this_ptr_conv.is_owned = false;
68382         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68383         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
68384         return ret_arr;
68385 }
68386
68387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68388         LDKPacket this_ptr_conv;
68389         this_ptr_conv.inner = untag_ptr(this_ptr);
68390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68392         this_ptr_conv.is_owned = false;
68393         LDKThirtyTwoBytes val_ref;
68394         CHECK((*env)->GetArrayLength(env, val) == 32);
68395         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68396         Packet_set_hmac(&this_ptr_conv, val_ref);
68397 }
68398
68399 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) {
68400         LDKPublicKey public_key_arg_ref;
68401         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
68402         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
68403         LDKCVec_u8Z hop_data_arg_ref;
68404         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
68405         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
68406         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
68407         LDKThirtyTwoBytes hmac_arg_ref;
68408         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
68409         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
68410         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
68411         int64_t ret_ref = 0;
68412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68414         return ret_ref;
68415 }
68416
68417 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
68418         LDKPacket ret_var = Packet_clone(arg);
68419         int64_t ret_ref = 0;
68420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68422         return ret_ref;
68423 }
68424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68425         LDKPacket arg_conv;
68426         arg_conv.inner = untag_ptr(arg);
68427         arg_conv.is_owned = ptr_is_owned(arg);
68428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68429         arg_conv.is_owned = false;
68430         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
68431         return ret_conv;
68432 }
68433
68434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68435         LDKPacket orig_conv;
68436         orig_conv.inner = untag_ptr(orig);
68437         orig_conv.is_owned = ptr_is_owned(orig);
68438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68439         orig_conv.is_owned = false;
68440         LDKPacket ret_var = Packet_clone(&orig_conv);
68441         int64_t ret_ref = 0;
68442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68444         return ret_ref;
68445 }
68446
68447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68448         LDKPacket a_conv;
68449         a_conv.inner = untag_ptr(a);
68450         a_conv.is_owned = ptr_is_owned(a);
68451         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68452         a_conv.is_owned = false;
68453         LDKPacket b_conv;
68454         b_conv.inner = untag_ptr(b);
68455         b_conv.is_owned = ptr_is_owned(b);
68456         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68457         b_conv.is_owned = false;
68458         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
68459         return ret_conv;
68460 }
68461
68462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
68463         LDKPacket obj_conv;
68464         obj_conv.inner = untag_ptr(obj);
68465         obj_conv.is_owned = ptr_is_owned(obj);
68466         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68467         obj_conv.is_owned = false;
68468         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
68469         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68470         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68471         CVec_u8Z_free(ret_var);
68472         return ret_arr;
68473 }
68474
68475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68476         if (!ptr_is_owned(this_ptr)) return;
68477         void* this_ptr_ptr = untag_ptr(this_ptr);
68478         CHECK_ACCESS(this_ptr_ptr);
68479         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
68480         FREE(untag_ptr(this_ptr));
68481         OnionMessageContents_free(this_ptr_conv);
68482 }
68483
68484 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
68485         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68486         *ret_copy = OnionMessageContents_clone(arg);
68487         int64_t ret_ref = tag_ptr(ret_copy, true);
68488         return ret_ref;
68489 }
68490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68491         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
68492         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
68493         return ret_conv;
68494 }
68495
68496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68497         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
68498         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68499         *ret_copy = OnionMessageContents_clone(orig_conv);
68500         int64_t ret_ref = tag_ptr(ret_copy, true);
68501         return ret_ref;
68502 }
68503
68504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
68505         void* a_ptr = untag_ptr(a);
68506         CHECK_ACCESS(a_ptr);
68507         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
68508         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
68509         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68510         *ret_copy = OnionMessageContents_offers(a_conv);
68511         int64_t ret_ref = tag_ptr(ret_copy, true);
68512         return ret_ref;
68513 }
68514
68515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
68516         void* a_ptr = untag_ptr(a);
68517         CHECK_ACCESS(a_ptr);
68518         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
68519         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
68520                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68521                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
68522         }
68523         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68524         *ret_copy = OnionMessageContents_custom(a_conv);
68525         int64_t ret_ref = tag_ptr(ret_copy, true);
68526         return ret_ref;
68527 }
68528
68529 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
68530         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
68531         *ret_ret = CustomOnionMessageContents_clone(arg);
68532         return tag_ptr(ret_ret, true);
68533 }
68534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68535         void* arg_ptr = untag_ptr(arg);
68536         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
68537         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
68538         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
68539         return ret_conv;
68540 }
68541
68542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68543         void* orig_ptr = untag_ptr(orig);
68544         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
68545         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
68546         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
68547         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
68548         return tag_ptr(ret_ret, true);
68549 }
68550
68551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68552         if (!ptr_is_owned(this_ptr)) return;
68553         void* this_ptr_ptr = untag_ptr(this_ptr);
68554         CHECK_ACCESS(this_ptr_ptr);
68555         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
68556         FREE(untag_ptr(this_ptr));
68557         CustomOnionMessageContents_free(this_ptr_conv);
68558 }
68559
68560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68561         LDKBlindedPath this_obj_conv;
68562         this_obj_conv.inner = untag_ptr(this_obj);
68563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68565         BlindedPath_free(this_obj_conv);
68566 }
68567
68568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
68569         LDKBlindedPath this_ptr_conv;
68570         this_ptr_conv.inner = untag_ptr(this_ptr);
68571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68573         this_ptr_conv.is_owned = false;
68574         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68575         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form);
68576         return ret_arr;
68577 }
68578
68579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68580         LDKBlindedPath this_ptr_conv;
68581         this_ptr_conv.inner = untag_ptr(this_ptr);
68582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68584         this_ptr_conv.is_owned = false;
68585         LDKPublicKey val_ref;
68586         CHECK((*env)->GetArrayLength(env, val) == 33);
68587         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68588         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
68589 }
68590
68591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
68592         LDKBlindedPath this_ptr_conv;
68593         this_ptr_conv.inner = untag_ptr(this_ptr);
68594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68596         this_ptr_conv.is_owned = false;
68597         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68598         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
68599         return ret_arr;
68600 }
68601
68602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68603         LDKBlindedPath this_ptr_conv;
68604         this_ptr_conv.inner = untag_ptr(this_ptr);
68605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68607         this_ptr_conv.is_owned = false;
68608         LDKPublicKey val_ref;
68609         CHECK((*env)->GetArrayLength(env, val) == 33);
68610         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68611         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
68612 }
68613
68614 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
68615         LDKBlindedPath this_ptr_conv;
68616         this_ptr_conv.inner = untag_ptr(this_ptr);
68617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68619         this_ptr_conv.is_owned = false;
68620         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
68621         int64_tArray ret_arr = NULL;
68622         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68623         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68624         for (size_t m = 0; m < ret_var.datalen; m++) {
68625                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
68626                 int64_t ret_conv_12_ref = 0;
68627                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
68628                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
68629                 ret_arr_ptr[m] = ret_conv_12_ref;
68630         }
68631         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68632         FREE(ret_var.data);
68633         return ret_arr;
68634 }
68635
68636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
68637         LDKBlindedPath this_ptr_conv;
68638         this_ptr_conv.inner = untag_ptr(this_ptr);
68639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68641         this_ptr_conv.is_owned = false;
68642         LDKCVec_BlindedHopZ val_constr;
68643         val_constr.datalen = (*env)->GetArrayLength(env, val);
68644         if (val_constr.datalen > 0)
68645                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
68646         else
68647                 val_constr.data = NULL;
68648         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
68649         for (size_t m = 0; m < val_constr.datalen; m++) {
68650                 int64_t val_conv_12 = val_vals[m];
68651                 LDKBlindedHop val_conv_12_conv;
68652                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
68653                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
68654                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
68655                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
68656                 val_constr.data[m] = val_conv_12_conv;
68657         }
68658         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
68659         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
68660 }
68661
68662 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) {
68663         LDKPublicKey introduction_node_id_arg_ref;
68664         CHECK((*env)->GetArrayLength(env, introduction_node_id_arg) == 33);
68665         (*env)->GetByteArrayRegion(env, introduction_node_id_arg, 0, 33, introduction_node_id_arg_ref.compressed_form);
68666         LDKPublicKey blinding_point_arg_ref;
68667         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
68668         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
68669         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
68670         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
68671         if (blinded_hops_arg_constr.datalen > 0)
68672                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
68673         else
68674                 blinded_hops_arg_constr.data = NULL;
68675         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
68676         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
68677                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
68678                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
68679                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
68680                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
68681                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
68682                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
68683                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
68684         }
68685         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
68686         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
68687         int64_t ret_ref = 0;
68688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68690         return ret_ref;
68691 }
68692
68693 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
68694         LDKBlindedPath ret_var = BlindedPath_clone(arg);
68695         int64_t ret_ref = 0;
68696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68698         return ret_ref;
68699 }
68700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68701         LDKBlindedPath arg_conv;
68702         arg_conv.inner = untag_ptr(arg);
68703         arg_conv.is_owned = ptr_is_owned(arg);
68704         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68705         arg_conv.is_owned = false;
68706         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
68707         return ret_conv;
68708 }
68709
68710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68711         LDKBlindedPath orig_conv;
68712         orig_conv.inner = untag_ptr(orig);
68713         orig_conv.is_owned = ptr_is_owned(orig);
68714         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68715         orig_conv.is_owned = false;
68716         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
68717         int64_t ret_ref = 0;
68718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68720         return ret_ref;
68721 }
68722
68723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
68724         LDKBlindedPath o_conv;
68725         o_conv.inner = untag_ptr(o);
68726         o_conv.is_owned = ptr_is_owned(o);
68727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68728         o_conv.is_owned = false;
68729         int64_t ret_conv = BlindedPath_hash(&o_conv);
68730         return ret_conv;
68731 }
68732
68733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68734         LDKBlindedPath a_conv;
68735         a_conv.inner = untag_ptr(a);
68736         a_conv.is_owned = ptr_is_owned(a);
68737         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68738         a_conv.is_owned = false;
68739         LDKBlindedPath b_conv;
68740         b_conv.inner = untag_ptr(b);
68741         b_conv.is_owned = ptr_is_owned(b);
68742         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68743         b_conv.is_owned = false;
68744         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
68745         return ret_conv;
68746 }
68747
68748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68749         LDKBlindedHop this_obj_conv;
68750         this_obj_conv.inner = untag_ptr(this_obj);
68751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68753         BlindedHop_free(this_obj_conv);
68754 }
68755
68756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
68757         LDKBlindedHop this_ptr_conv;
68758         this_ptr_conv.inner = untag_ptr(this_ptr);
68759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68761         this_ptr_conv.is_owned = false;
68762         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68763         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
68764         return ret_arr;
68765 }
68766
68767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68768         LDKBlindedHop this_ptr_conv;
68769         this_ptr_conv.inner = untag_ptr(this_ptr);
68770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68772         this_ptr_conv.is_owned = false;
68773         LDKPublicKey val_ref;
68774         CHECK((*env)->GetArrayLength(env, val) == 33);
68775         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68776         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
68777 }
68778
68779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
68780         LDKBlindedHop this_ptr_conv;
68781         this_ptr_conv.inner = untag_ptr(this_ptr);
68782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68784         this_ptr_conv.is_owned = false;
68785         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
68786         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68787         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68788         CVec_u8Z_free(ret_var);
68789         return ret_arr;
68790 }
68791
68792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68793         LDKBlindedHop this_ptr_conv;
68794         this_ptr_conv.inner = untag_ptr(this_ptr);
68795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68797         this_ptr_conv.is_owned = false;
68798         LDKCVec_u8Z val_ref;
68799         val_ref.datalen = (*env)->GetArrayLength(env, val);
68800         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
68801         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
68802         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
68803 }
68804
68805 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) {
68806         LDKPublicKey blinded_node_id_arg_ref;
68807         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
68808         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
68809         LDKCVec_u8Z encrypted_payload_arg_ref;
68810         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
68811         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
68812         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
68813         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
68814         int64_t ret_ref = 0;
68815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68817         return ret_ref;
68818 }
68819
68820 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
68821         LDKBlindedHop ret_var = BlindedHop_clone(arg);
68822         int64_t ret_ref = 0;
68823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68825         return ret_ref;
68826 }
68827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68828         LDKBlindedHop arg_conv;
68829         arg_conv.inner = untag_ptr(arg);
68830         arg_conv.is_owned = ptr_is_owned(arg);
68831         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68832         arg_conv.is_owned = false;
68833         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
68834         return ret_conv;
68835 }
68836
68837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68838         LDKBlindedHop orig_conv;
68839         orig_conv.inner = untag_ptr(orig);
68840         orig_conv.is_owned = ptr_is_owned(orig);
68841         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68842         orig_conv.is_owned = false;
68843         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
68844         int64_t ret_ref = 0;
68845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68847         return ret_ref;
68848 }
68849
68850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
68851         LDKBlindedHop o_conv;
68852         o_conv.inner = untag_ptr(o);
68853         o_conv.is_owned = ptr_is_owned(o);
68854         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68855         o_conv.is_owned = false;
68856         int64_t ret_conv = BlindedHop_hash(&o_conv);
68857         return ret_conv;
68858 }
68859
68860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68861         LDKBlindedHop a_conv;
68862         a_conv.inner = untag_ptr(a);
68863         a_conv.is_owned = ptr_is_owned(a);
68864         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68865         a_conv.is_owned = false;
68866         LDKBlindedHop b_conv;
68867         b_conv.inner = untag_ptr(b);
68868         b_conv.is_owned = ptr_is_owned(b);
68869         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68870         b_conv.is_owned = false;
68871         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
68872         return ret_conv;
68873 }
68874
68875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
68876         LDKCVec_PublicKeyZ node_pks_constr;
68877         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
68878         if (node_pks_constr.datalen > 0)
68879                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
68880         else
68881                 node_pks_constr.data = NULL;
68882         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
68883                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
68884                 LDKPublicKey node_pks_conv_8_ref;
68885                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
68886                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
68887                 node_pks_constr.data[i] = node_pks_conv_8_ref;
68888         }
68889         void* entropy_source_ptr = untag_ptr(entropy_source);
68890         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68891         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68892         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
68893         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
68894         return tag_ptr(ret_conv, true);
68895 }
68896
68897 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) {
68898         LDKPublicKey payee_node_id_ref;
68899         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
68900         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
68901         LDKReceiveTlvs payee_tlvs_conv;
68902         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
68903         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
68904         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
68905         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
68906         void* entropy_source_ptr = untag_ptr(entropy_source);
68907         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68908         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68909         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
68910         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
68911         return tag_ptr(ret_conv, true);
68912 }
68913
68914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
68915         LDKBlindedPath obj_conv;
68916         obj_conv.inner = untag_ptr(obj);
68917         obj_conv.is_owned = ptr_is_owned(obj);
68918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68919         obj_conv.is_owned = false;
68920         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
68921         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68922         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68923         CVec_u8Z_free(ret_var);
68924         return ret_arr;
68925 }
68926
68927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68928         LDKu8slice ser_ref;
68929         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68930         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68931         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
68932         *ret_conv = BlindedPath_read(ser_ref);
68933         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68934         return tag_ptr(ret_conv, true);
68935 }
68936
68937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
68938         LDKBlindedHop obj_conv;
68939         obj_conv.inner = untag_ptr(obj);
68940         obj_conv.is_owned = ptr_is_owned(obj);
68941         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68942         obj_conv.is_owned = false;
68943         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
68944         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68945         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68946         CVec_u8Z_free(ret_var);
68947         return ret_arr;
68948 }
68949
68950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68951         LDKu8slice ser_ref;
68952         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68953         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68954         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
68955         *ret_conv = BlindedHop_read(ser_ref);
68956         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68957         return tag_ptr(ret_conv, true);
68958 }
68959
68960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68961         LDKForwardNode this_obj_conv;
68962         this_obj_conv.inner = untag_ptr(this_obj);
68963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68965         ForwardNode_free(this_obj_conv);
68966 }
68967
68968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
68969         LDKForwardNode this_ptr_conv;
68970         this_ptr_conv.inner = untag_ptr(this_ptr);
68971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68973         this_ptr_conv.is_owned = false;
68974         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
68975         int64_t ret_ref = 0;
68976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68978         return ret_ref;
68979 }
68980
68981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68982         LDKForwardNode this_ptr_conv;
68983         this_ptr_conv.inner = untag_ptr(this_ptr);
68984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68986         this_ptr_conv.is_owned = false;
68987         LDKForwardTlvs val_conv;
68988         val_conv.inner = untag_ptr(val);
68989         val_conv.is_owned = ptr_is_owned(val);
68990         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68991         val_conv = ForwardTlvs_clone(&val_conv);
68992         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
68993 }
68994
68995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
68996         LDKForwardNode this_ptr_conv;
68997         this_ptr_conv.inner = untag_ptr(this_ptr);
68998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69000         this_ptr_conv.is_owned = false;
69001         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69002         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
69003         return ret_arr;
69004 }
69005
69006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69007         LDKForwardNode this_ptr_conv;
69008         this_ptr_conv.inner = untag_ptr(this_ptr);
69009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69011         this_ptr_conv.is_owned = false;
69012         LDKPublicKey val_ref;
69013         CHECK((*env)->GetArrayLength(env, val) == 33);
69014         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69015         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
69016 }
69017
69018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69019         LDKForwardNode this_ptr_conv;
69020         this_ptr_conv.inner = untag_ptr(this_ptr);
69021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69023         this_ptr_conv.is_owned = false;
69024         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
69025         return ret_conv;
69026 }
69027
69028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69029         LDKForwardNode this_ptr_conv;
69030         this_ptr_conv.inner = untag_ptr(this_ptr);
69031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69033         this_ptr_conv.is_owned = false;
69034         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
69035 }
69036
69037 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) {
69038         LDKForwardTlvs tlvs_arg_conv;
69039         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
69040         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
69041         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
69042         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
69043         LDKPublicKey node_id_arg_ref;
69044         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
69045         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
69046         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
69047         int64_t ret_ref = 0;
69048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69050         return ret_ref;
69051 }
69052
69053 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
69054         LDKForwardNode ret_var = ForwardNode_clone(arg);
69055         int64_t ret_ref = 0;
69056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69058         return ret_ref;
69059 }
69060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69061         LDKForwardNode arg_conv;
69062         arg_conv.inner = untag_ptr(arg);
69063         arg_conv.is_owned = ptr_is_owned(arg);
69064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69065         arg_conv.is_owned = false;
69066         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
69067         return ret_conv;
69068 }
69069
69070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69071         LDKForwardNode orig_conv;
69072         orig_conv.inner = untag_ptr(orig);
69073         orig_conv.is_owned = ptr_is_owned(orig);
69074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69075         orig_conv.is_owned = false;
69076         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
69077         int64_t ret_ref = 0;
69078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69080         return ret_ref;
69081 }
69082
69083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69084         LDKForwardTlvs this_obj_conv;
69085         this_obj_conv.inner = untag_ptr(this_obj);
69086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69088         ForwardTlvs_free(this_obj_conv);
69089 }
69090
69091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69092         LDKForwardTlvs this_ptr_conv;
69093         this_ptr_conv.inner = untag_ptr(this_ptr);
69094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69096         this_ptr_conv.is_owned = false;
69097         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
69098         return ret_conv;
69099 }
69100
69101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69102         LDKForwardTlvs this_ptr_conv;
69103         this_ptr_conv.inner = untag_ptr(this_ptr);
69104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69106         this_ptr_conv.is_owned = false;
69107         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
69108 }
69109
69110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
69111         LDKForwardTlvs this_ptr_conv;
69112         this_ptr_conv.inner = untag_ptr(this_ptr);
69113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69115         this_ptr_conv.is_owned = false;
69116         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
69117         int64_t ret_ref = 0;
69118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69120         return ret_ref;
69121 }
69122
69123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69124         LDKForwardTlvs this_ptr_conv;
69125         this_ptr_conv.inner = untag_ptr(this_ptr);
69126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69128         this_ptr_conv.is_owned = false;
69129         LDKPaymentRelay val_conv;
69130         val_conv.inner = untag_ptr(val);
69131         val_conv.is_owned = ptr_is_owned(val);
69132         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69133         val_conv = PaymentRelay_clone(&val_conv);
69134         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
69135 }
69136
69137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
69138         LDKForwardTlvs this_ptr_conv;
69139         this_ptr_conv.inner = untag_ptr(this_ptr);
69140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69142         this_ptr_conv.is_owned = false;
69143         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
69144         int64_t ret_ref = 0;
69145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69147         return ret_ref;
69148 }
69149
69150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69151         LDKForwardTlvs this_ptr_conv;
69152         this_ptr_conv.inner = untag_ptr(this_ptr);
69153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69155         this_ptr_conv.is_owned = false;
69156         LDKPaymentConstraints val_conv;
69157         val_conv.inner = untag_ptr(val);
69158         val_conv.is_owned = ptr_is_owned(val);
69159         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69160         val_conv = PaymentConstraints_clone(&val_conv);
69161         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
69162 }
69163
69164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
69165         LDKForwardTlvs this_ptr_conv;
69166         this_ptr_conv.inner = untag_ptr(this_ptr);
69167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69169         this_ptr_conv.is_owned = false;
69170         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
69171         int64_t ret_ref = 0;
69172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69174         return ret_ref;
69175 }
69176
69177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69178         LDKForwardTlvs this_ptr_conv;
69179         this_ptr_conv.inner = untag_ptr(this_ptr);
69180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69182         this_ptr_conv.is_owned = false;
69183         LDKBlindedHopFeatures val_conv;
69184         val_conv.inner = untag_ptr(val);
69185         val_conv.is_owned = ptr_is_owned(val);
69186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69187         val_conv = BlindedHopFeatures_clone(&val_conv);
69188         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
69189 }
69190
69191 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) {
69192         LDKPaymentRelay payment_relay_arg_conv;
69193         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
69194         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
69195         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
69196         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
69197         LDKPaymentConstraints payment_constraints_arg_conv;
69198         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
69199         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
69200         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
69201         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
69202         LDKBlindedHopFeatures features_arg_conv;
69203         features_arg_conv.inner = untag_ptr(features_arg);
69204         features_arg_conv.is_owned = ptr_is_owned(features_arg);
69205         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
69206         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
69207         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
69208         int64_t ret_ref = 0;
69209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69211         return ret_ref;
69212 }
69213
69214 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
69215         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
69216         int64_t ret_ref = 0;
69217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69219         return ret_ref;
69220 }
69221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69222         LDKForwardTlvs arg_conv;
69223         arg_conv.inner = untag_ptr(arg);
69224         arg_conv.is_owned = ptr_is_owned(arg);
69225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69226         arg_conv.is_owned = false;
69227         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
69228         return ret_conv;
69229 }
69230
69231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69232         LDKForwardTlvs orig_conv;
69233         orig_conv.inner = untag_ptr(orig);
69234         orig_conv.is_owned = ptr_is_owned(orig);
69235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69236         orig_conv.is_owned = false;
69237         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
69238         int64_t ret_ref = 0;
69239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69241         return ret_ref;
69242 }
69243
69244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69245         LDKReceiveTlvs this_obj_conv;
69246         this_obj_conv.inner = untag_ptr(this_obj);
69247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69249         ReceiveTlvs_free(this_obj_conv);
69250 }
69251
69252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
69253         LDKReceiveTlvs this_ptr_conv;
69254         this_ptr_conv.inner = untag_ptr(this_ptr);
69255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69257         this_ptr_conv.is_owned = false;
69258         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69259         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
69260         return ret_arr;
69261 }
69262
69263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69264         LDKReceiveTlvs this_ptr_conv;
69265         this_ptr_conv.inner = untag_ptr(this_ptr);
69266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69268         this_ptr_conv.is_owned = false;
69269         LDKThirtyTwoBytes val_ref;
69270         CHECK((*env)->GetArrayLength(env, val) == 32);
69271         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69272         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
69273 }
69274
69275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
69276         LDKReceiveTlvs this_ptr_conv;
69277         this_ptr_conv.inner = untag_ptr(this_ptr);
69278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69280         this_ptr_conv.is_owned = false;
69281         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
69282         int64_t ret_ref = 0;
69283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69285         return ret_ref;
69286 }
69287
69288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69289         LDKReceiveTlvs this_ptr_conv;
69290         this_ptr_conv.inner = untag_ptr(this_ptr);
69291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69293         this_ptr_conv.is_owned = false;
69294         LDKPaymentConstraints val_conv;
69295         val_conv.inner = untag_ptr(val);
69296         val_conv.is_owned = ptr_is_owned(val);
69297         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69298         val_conv = PaymentConstraints_clone(&val_conv);
69299         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
69300 }
69301
69302 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) {
69303         LDKThirtyTwoBytes payment_secret_arg_ref;
69304         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
69305         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
69306         LDKPaymentConstraints payment_constraints_arg_conv;
69307         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
69308         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
69309         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
69310         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
69311         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
69312         int64_t ret_ref = 0;
69313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69315         return ret_ref;
69316 }
69317
69318 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
69319         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
69320         int64_t ret_ref = 0;
69321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69323         return ret_ref;
69324 }
69325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69326         LDKReceiveTlvs arg_conv;
69327         arg_conv.inner = untag_ptr(arg);
69328         arg_conv.is_owned = ptr_is_owned(arg);
69329         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69330         arg_conv.is_owned = false;
69331         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
69332         return ret_conv;
69333 }
69334
69335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69336         LDKReceiveTlvs orig_conv;
69337         orig_conv.inner = untag_ptr(orig);
69338         orig_conv.is_owned = ptr_is_owned(orig);
69339         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69340         orig_conv.is_owned = false;
69341         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
69342         int64_t ret_ref = 0;
69343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69345         return ret_ref;
69346 }
69347
69348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69349         LDKPaymentRelay this_obj_conv;
69350         this_obj_conv.inner = untag_ptr(this_obj);
69351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69353         PaymentRelay_free(this_obj_conv);
69354 }
69355
69356 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
69357         LDKPaymentRelay this_ptr_conv;
69358         this_ptr_conv.inner = untag_ptr(this_ptr);
69359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69361         this_ptr_conv.is_owned = false;
69362         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
69363         return ret_conv;
69364 }
69365
69366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
69367         LDKPaymentRelay this_ptr_conv;
69368         this_ptr_conv.inner = untag_ptr(this_ptr);
69369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69371         this_ptr_conv.is_owned = false;
69372         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
69373 }
69374
69375 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
69376         LDKPaymentRelay this_ptr_conv;
69377         this_ptr_conv.inner = untag_ptr(this_ptr);
69378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69380         this_ptr_conv.is_owned = false;
69381         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
69382         return ret_conv;
69383 }
69384
69385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69386         LDKPaymentRelay this_ptr_conv;
69387         this_ptr_conv.inner = untag_ptr(this_ptr);
69388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69390         this_ptr_conv.is_owned = false;
69391         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
69392 }
69393
69394 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69395         LDKPaymentRelay this_ptr_conv;
69396         this_ptr_conv.inner = untag_ptr(this_ptr);
69397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69399         this_ptr_conv.is_owned = false;
69400         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
69401         return ret_conv;
69402 }
69403
69404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69405         LDKPaymentRelay this_ptr_conv;
69406         this_ptr_conv.inner = untag_ptr(this_ptr);
69407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69409         this_ptr_conv.is_owned = false;
69410         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
69411 }
69412
69413 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) {
69414         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
69415         int64_t ret_ref = 0;
69416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69418         return ret_ref;
69419 }
69420
69421 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
69422         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
69423         int64_t ret_ref = 0;
69424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69426         return ret_ref;
69427 }
69428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69429         LDKPaymentRelay arg_conv;
69430         arg_conv.inner = untag_ptr(arg);
69431         arg_conv.is_owned = ptr_is_owned(arg);
69432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69433         arg_conv.is_owned = false;
69434         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
69435         return ret_conv;
69436 }
69437
69438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69439         LDKPaymentRelay orig_conv;
69440         orig_conv.inner = untag_ptr(orig);
69441         orig_conv.is_owned = ptr_is_owned(orig);
69442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69443         orig_conv.is_owned = false;
69444         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
69445         int64_t ret_ref = 0;
69446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69448         return ret_ref;
69449 }
69450
69451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69452         LDKPaymentConstraints this_obj_conv;
69453         this_obj_conv.inner = untag_ptr(this_obj);
69454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69456         PaymentConstraints_free(this_obj_conv);
69457 }
69458
69459 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
69460         LDKPaymentConstraints this_ptr_conv;
69461         this_ptr_conv.inner = untag_ptr(this_ptr);
69462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69464         this_ptr_conv.is_owned = false;
69465         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
69466         return ret_conv;
69467 }
69468
69469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69470         LDKPaymentConstraints this_ptr_conv;
69471         this_ptr_conv.inner = untag_ptr(this_ptr);
69472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69474         this_ptr_conv.is_owned = false;
69475         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
69476 }
69477
69478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69479         LDKPaymentConstraints this_ptr_conv;
69480         this_ptr_conv.inner = untag_ptr(this_ptr);
69481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69483         this_ptr_conv.is_owned = false;
69484         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
69485         return ret_conv;
69486 }
69487
69488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69489         LDKPaymentConstraints this_ptr_conv;
69490         this_ptr_conv.inner = untag_ptr(this_ptr);
69491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69493         this_ptr_conv.is_owned = false;
69494         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
69495 }
69496
69497 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) {
69498         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
69499         int64_t ret_ref = 0;
69500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69502         return ret_ref;
69503 }
69504
69505 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
69506         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
69507         int64_t ret_ref = 0;
69508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69510         return ret_ref;
69511 }
69512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69513         LDKPaymentConstraints arg_conv;
69514         arg_conv.inner = untag_ptr(arg);
69515         arg_conv.is_owned = ptr_is_owned(arg);
69516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69517         arg_conv.is_owned = false;
69518         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
69519         return ret_conv;
69520 }
69521
69522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69523         LDKPaymentConstraints orig_conv;
69524         orig_conv.inner = untag_ptr(orig);
69525         orig_conv.is_owned = ptr_is_owned(orig);
69526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69527         orig_conv.is_owned = false;
69528         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
69529         int64_t ret_ref = 0;
69530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69532         return ret_ref;
69533 }
69534
69535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
69536         LDKForwardTlvs obj_conv;
69537         obj_conv.inner = untag_ptr(obj);
69538         obj_conv.is_owned = ptr_is_owned(obj);
69539         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69540         obj_conv.is_owned = false;
69541         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
69542         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69543         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69544         CVec_u8Z_free(ret_var);
69545         return ret_arr;
69546 }
69547
69548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
69549         LDKReceiveTlvs obj_conv;
69550         obj_conv.inner = untag_ptr(obj);
69551         obj_conv.is_owned = ptr_is_owned(obj);
69552         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69553         obj_conv.is_owned = false;
69554         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
69555         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69556         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69557         CVec_u8Z_free(ret_var);
69558         return ret_arr;
69559 }
69560
69561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69562         LDKu8slice ser_ref;
69563         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69564         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69565         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
69566         *ret_conv = ReceiveTlvs_read(ser_ref);
69567         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69568         return tag_ptr(ret_conv, true);
69569 }
69570
69571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
69572         LDKPaymentRelay obj_conv;
69573         obj_conv.inner = untag_ptr(obj);
69574         obj_conv.is_owned = ptr_is_owned(obj);
69575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69576         obj_conv.is_owned = false;
69577         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
69578         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69579         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69580         CVec_u8Z_free(ret_var);
69581         return ret_arr;
69582 }
69583
69584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69585         LDKu8slice ser_ref;
69586         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69587         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69588         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
69589         *ret_conv = PaymentRelay_read(ser_ref);
69590         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69591         return tag_ptr(ret_conv, true);
69592 }
69593
69594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
69595         LDKPaymentConstraints obj_conv;
69596         obj_conv.inner = untag_ptr(obj);
69597         obj_conv.is_owned = ptr_is_owned(obj);
69598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69599         obj_conv.is_owned = false;
69600         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
69601         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69602         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69603         CVec_u8Z_free(ret_var);
69604         return ret_arr;
69605 }
69606
69607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69608         LDKu8slice ser_ref;
69609         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69610         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69611         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
69612         *ret_conv = PaymentConstraints_read(ser_ref);
69613         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69614         return tag_ptr(ret_conv, true);
69615 }
69616
69617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69618         if (!ptr_is_owned(this_ptr)) return;
69619         void* this_ptr_ptr = untag_ptr(this_ptr);
69620         CHECK_ACCESS(this_ptr_ptr);
69621         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
69622         FREE(untag_ptr(this_ptr));
69623         PaymentPurpose_free(this_ptr_conv);
69624 }
69625
69626 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
69627         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69628         *ret_copy = PaymentPurpose_clone(arg);
69629         int64_t ret_ref = tag_ptr(ret_copy, true);
69630         return ret_ref;
69631 }
69632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69633         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
69634         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
69635         return ret_conv;
69636 }
69637
69638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69639         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
69640         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69641         *ret_copy = PaymentPurpose_clone(orig_conv);
69642         int64_t ret_ref = tag_ptr(ret_copy, true);
69643         return ret_ref;
69644 }
69645
69646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
69647         void* payment_preimage_ptr = untag_ptr(payment_preimage);
69648         CHECK_ACCESS(payment_preimage_ptr);
69649         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
69650         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
69651         LDKThirtyTwoBytes payment_secret_ref;
69652         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
69653         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
69654         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69655         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
69656         int64_t ret_ref = tag_ptr(ret_copy, true);
69657         return ret_ref;
69658 }
69659
69660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
69661         LDKThirtyTwoBytes a_ref;
69662         CHECK((*env)->GetArrayLength(env, a) == 32);
69663         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
69664         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69665         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
69666         int64_t ret_ref = tag_ptr(ret_copy, true);
69667         return ret_ref;
69668 }
69669
69670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69671         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
69672         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
69673         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
69674         return ret_conv;
69675 }
69676
69677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
69678         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
69679         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
69680         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69681         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69682         CVec_u8Z_free(ret_var);
69683         return ret_arr;
69684 }
69685
69686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69687         LDKu8slice ser_ref;
69688         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69689         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69690         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
69691         *ret_conv = PaymentPurpose_read(ser_ref);
69692         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69693         return tag_ptr(ret_conv, true);
69694 }
69695
69696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69697         LDKClaimedHTLC this_obj_conv;
69698         this_obj_conv.inner = untag_ptr(this_obj);
69699         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69701         ClaimedHTLC_free(this_obj_conv);
69702 }
69703
69704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69705         LDKClaimedHTLC this_ptr_conv;
69706         this_ptr_conv.inner = untag_ptr(this_ptr);
69707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69709         this_ptr_conv.is_owned = false;
69710         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69711         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClaimedHTLC_get_channel_id(&this_ptr_conv));
69712         return ret_arr;
69713 }
69714
69715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69716         LDKClaimedHTLC this_ptr_conv;
69717         this_ptr_conv.inner = untag_ptr(this_ptr);
69718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69720         this_ptr_conv.is_owned = false;
69721         LDKThirtyTwoBytes val_ref;
69722         CHECK((*env)->GetArrayLength(env, val) == 32);
69723         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69724         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
69725 }
69726
69727 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69728         LDKClaimedHTLC this_ptr_conv;
69729         this_ptr_conv.inner = untag_ptr(this_ptr);
69730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69732         this_ptr_conv.is_owned = false;
69733         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
69734         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
69735         return ret_arr;
69736 }
69737
69738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69739         LDKClaimedHTLC this_ptr_conv;
69740         this_ptr_conv.inner = untag_ptr(this_ptr);
69741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69743         this_ptr_conv.is_owned = false;
69744         LDKU128 val_ref;
69745         CHECK((*env)->GetArrayLength(env, val) == 16);
69746         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
69747         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
69748 }
69749
69750 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
69751         LDKClaimedHTLC this_ptr_conv;
69752         this_ptr_conv.inner = untag_ptr(this_ptr);
69753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69755         this_ptr_conv.is_owned = false;
69756         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
69757         return ret_conv;
69758 }
69759
69760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69761         LDKClaimedHTLC this_ptr_conv;
69762         this_ptr_conv.inner = untag_ptr(this_ptr);
69763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69765         this_ptr_conv.is_owned = false;
69766         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
69767 }
69768
69769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69770         LDKClaimedHTLC this_ptr_conv;
69771         this_ptr_conv.inner = untag_ptr(this_ptr);
69772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69774         this_ptr_conv.is_owned = false;
69775         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
69776         return ret_conv;
69777 }
69778
69779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69780         LDKClaimedHTLC this_ptr_conv;
69781         this_ptr_conv.inner = untag_ptr(this_ptr);
69782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69784         this_ptr_conv.is_owned = false;
69785         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
69786 }
69787
69788 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) {
69789         LDKThirtyTwoBytes channel_id_arg_ref;
69790         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
69791         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
69792         LDKU128 user_channel_id_arg_ref;
69793         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
69794         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
69795         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
69796         int64_t ret_ref = 0;
69797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69799         return ret_ref;
69800 }
69801
69802 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
69803         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69810         LDKClaimedHTLC arg_conv;
69811         arg_conv.inner = untag_ptr(arg);
69812         arg_conv.is_owned = ptr_is_owned(arg);
69813         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69814         arg_conv.is_owned = false;
69815         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
69816         return ret_conv;
69817 }
69818
69819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69820         LDKClaimedHTLC orig_conv;
69821         orig_conv.inner = untag_ptr(orig);
69822         orig_conv.is_owned = ptr_is_owned(orig);
69823         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69824         orig_conv.is_owned = false;
69825         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
69826         int64_t ret_ref = 0;
69827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69829         return ret_ref;
69830 }
69831
69832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69833         LDKClaimedHTLC a_conv;
69834         a_conv.inner = untag_ptr(a);
69835         a_conv.is_owned = ptr_is_owned(a);
69836         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69837         a_conv.is_owned = false;
69838         LDKClaimedHTLC b_conv;
69839         b_conv.inner = untag_ptr(b);
69840         b_conv.is_owned = ptr_is_owned(b);
69841         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69842         b_conv.is_owned = false;
69843         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
69844         return ret_conv;
69845 }
69846
69847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
69848         LDKClaimedHTLC obj_conv;
69849         obj_conv.inner = untag_ptr(obj);
69850         obj_conv.is_owned = ptr_is_owned(obj);
69851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69852         obj_conv.is_owned = false;
69853         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
69854         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69855         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69856         CVec_u8Z_free(ret_var);
69857         return ret_arr;
69858 }
69859
69860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69861         LDKu8slice ser_ref;
69862         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69863         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69864         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
69865         *ret_conv = ClaimedHTLC_read(ser_ref);
69866         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69867         return tag_ptr(ret_conv, true);
69868 }
69869
69870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69871         if (!ptr_is_owned(this_ptr)) return;
69872         void* this_ptr_ptr = untag_ptr(this_ptr);
69873         CHECK_ACCESS(this_ptr_ptr);
69874         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
69875         FREE(untag_ptr(this_ptr));
69876         PathFailure_free(this_ptr_conv);
69877 }
69878
69879 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
69880         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69881         *ret_copy = PathFailure_clone(arg);
69882         int64_t ret_ref = tag_ptr(ret_copy, true);
69883         return ret_ref;
69884 }
69885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69886         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
69887         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
69888         return ret_conv;
69889 }
69890
69891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69892         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
69893         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69894         *ret_copy = PathFailure_clone(orig_conv);
69895         int64_t ret_ref = tag_ptr(ret_copy, true);
69896         return ret_ref;
69897 }
69898
69899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
69900         void* err_ptr = untag_ptr(err);
69901         CHECK_ACCESS(err_ptr);
69902         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
69903         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
69904         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69905         *ret_copy = PathFailure_initial_send(err_conv);
69906         int64_t ret_ref = tag_ptr(ret_copy, true);
69907         return ret_ref;
69908 }
69909
69910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
69911         void* network_update_ptr = untag_ptr(network_update);
69912         CHECK_ACCESS(network_update_ptr);
69913         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
69914         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
69915         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69916         *ret_copy = PathFailure_on_path(network_update_conv);
69917         int64_t ret_ref = tag_ptr(ret_copy, true);
69918         return ret_ref;
69919 }
69920
69921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69922         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
69923         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
69924         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
69925         return ret_conv;
69926 }
69927
69928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
69929         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
69930         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
69931         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69932         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69933         CVec_u8Z_free(ret_var);
69934         return ret_arr;
69935 }
69936
69937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69938         LDKu8slice ser_ref;
69939         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69940         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69941         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
69942         *ret_conv = PathFailure_read(ser_ref);
69943         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69944         return tag_ptr(ret_conv, true);
69945 }
69946
69947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69948         if (!ptr_is_owned(this_ptr)) return;
69949         void* this_ptr_ptr = untag_ptr(this_ptr);
69950         CHECK_ACCESS(this_ptr_ptr);
69951         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
69952         FREE(untag_ptr(this_ptr));
69953         ClosureReason_free(this_ptr_conv);
69954 }
69955
69956 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
69957         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69958         *ret_copy = ClosureReason_clone(arg);
69959         int64_t ret_ref = tag_ptr(ret_copy, true);
69960         return ret_ref;
69961 }
69962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69963         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
69964         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
69965         return ret_conv;
69966 }
69967
69968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69969         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
69970         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69971         *ret_copy = ClosureReason_clone(orig_conv);
69972         int64_t ret_ref = tag_ptr(ret_copy, true);
69973         return ret_ref;
69974 }
69975
69976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
69977         LDKUntrustedString peer_msg_conv;
69978         peer_msg_conv.inner = untag_ptr(peer_msg);
69979         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
69980         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
69981         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
69982         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69983         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
69984         int64_t ret_ref = tag_ptr(ret_copy, true);
69985         return ret_ref;
69986 }
69987
69988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
69989         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69990         *ret_copy = ClosureReason_holder_force_closed();
69991         int64_t ret_ref = tag_ptr(ret_copy, true);
69992         return ret_ref;
69993 }
69994
69995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
69996         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69997         *ret_copy = ClosureReason_cooperative_closure();
69998         int64_t ret_ref = tag_ptr(ret_copy, true);
69999         return ret_ref;
70000 }
70001
70002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
70003         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70004         *ret_copy = ClosureReason_commitment_tx_confirmed();
70005         int64_t ret_ref = tag_ptr(ret_copy, true);
70006         return ret_ref;
70007 }
70008
70009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
70010         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70011         *ret_copy = ClosureReason_funding_timed_out();
70012         int64_t ret_ref = tag_ptr(ret_copy, true);
70013         return ret_ref;
70014 }
70015
70016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
70017         LDKStr err_conv = java_to_owned_str(env, err);
70018         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70019         *ret_copy = ClosureReason_processing_error(err_conv);
70020         int64_t ret_ref = tag_ptr(ret_copy, true);
70021         return ret_ref;
70022 }
70023
70024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
70025         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70026         *ret_copy = ClosureReason_disconnected_peer();
70027         int64_t ret_ref = tag_ptr(ret_copy, true);
70028         return ret_ref;
70029 }
70030
70031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
70032         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70033         *ret_copy = ClosureReason_outdated_channel_manager();
70034         int64_t ret_ref = tag_ptr(ret_copy, true);
70035         return ret_ref;
70036 }
70037
70038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
70039         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70040         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
70041         int64_t ret_ref = tag_ptr(ret_copy, true);
70042         return ret_ref;
70043 }
70044
70045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
70046         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70047         *ret_copy = ClosureReason_funding_batch_closure();
70048         int64_t ret_ref = tag_ptr(ret_copy, true);
70049         return ret_ref;
70050 }
70051
70052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70053         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
70054         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
70055         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
70056         return ret_conv;
70057 }
70058
70059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
70060         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
70061         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
70062         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70063         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70064         CVec_u8Z_free(ret_var);
70065         return ret_arr;
70066 }
70067
70068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70069         LDKu8slice ser_ref;
70070         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70071         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70072         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
70073         *ret_conv = ClosureReason_read(ser_ref);
70074         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70075         return tag_ptr(ret_conv, true);
70076 }
70077
70078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70079         if (!ptr_is_owned(this_ptr)) return;
70080         void* this_ptr_ptr = untag_ptr(this_ptr);
70081         CHECK_ACCESS(this_ptr_ptr);
70082         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
70083         FREE(untag_ptr(this_ptr));
70084         HTLCDestination_free(this_ptr_conv);
70085 }
70086
70087 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
70088         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70089         *ret_copy = HTLCDestination_clone(arg);
70090         int64_t ret_ref = tag_ptr(ret_copy, true);
70091         return ret_ref;
70092 }
70093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70094         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
70095         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
70096         return ret_conv;
70097 }
70098
70099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70100         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
70101         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70102         *ret_copy = HTLCDestination_clone(orig_conv);
70103         int64_t ret_ref = tag_ptr(ret_copy, true);
70104         return ret_ref;
70105 }
70106
70107 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) {
70108         LDKPublicKey node_id_ref;
70109         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70110         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70111         LDKThirtyTwoBytes channel_id_ref;
70112         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70113         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70114         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70115         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
70116         int64_t ret_ref = tag_ptr(ret_copy, true);
70117         return ret_ref;
70118 }
70119
70120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
70121         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70122         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
70123         int64_t ret_ref = tag_ptr(ret_copy, true);
70124         return ret_ref;
70125 }
70126
70127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
70128         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70129         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
70130         int64_t ret_ref = tag_ptr(ret_copy, true);
70131         return ret_ref;
70132 }
70133
70134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
70135         LDKThirtyTwoBytes payment_hash_ref;
70136         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70137         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70138         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70139         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
70140         int64_t ret_ref = tag_ptr(ret_copy, true);
70141         return ret_ref;
70142 }
70143
70144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70145         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
70146         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
70147         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
70148         return ret_conv;
70149 }
70150
70151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
70152         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
70153         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
70154         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70155         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70156         CVec_u8Z_free(ret_var);
70157         return ret_arr;
70158 }
70159
70160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70161         LDKu8slice ser_ref;
70162         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70163         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70164         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
70165         *ret_conv = HTLCDestination_read(ser_ref);
70166         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70167         return tag_ptr(ret_conv, true);
70168 }
70169
70170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70171         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
70172         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
70173         return ret_conv;
70174 }
70175
70176 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
70177         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
70178         return ret_conv;
70179 }
70180
70181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
70182         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
70183         return ret_conv;
70184 }
70185
70186 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
70187         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
70188         return ret_conv;
70189 }
70190
70191 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
70192         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
70193         return ret_conv;
70194 }
70195
70196 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
70197         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
70198         return ret_conv;
70199 }
70200
70201 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
70202         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
70203         return ret_conv;
70204 }
70205
70206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70207         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
70208         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
70209         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
70210         return ret_conv;
70211 }
70212
70213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
70214         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
70215         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
70216         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70217         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70218         CVec_u8Z_free(ret_var);
70219         return ret_arr;
70220 }
70221
70222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70223         LDKu8slice ser_ref;
70224         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70225         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70226         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
70227         *ret_conv = PaymentFailureReason_read(ser_ref);
70228         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70229         return tag_ptr(ret_conv, true);
70230 }
70231
70232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70233         if (!ptr_is_owned(this_ptr)) return;
70234         void* this_ptr_ptr = untag_ptr(this_ptr);
70235         CHECK_ACCESS(this_ptr_ptr);
70236         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
70237         FREE(untag_ptr(this_ptr));
70238         Event_free(this_ptr_conv);
70239 }
70240
70241 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
70242         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70243         *ret_copy = Event_clone(arg);
70244         int64_t ret_ref = tag_ptr(ret_copy, true);
70245         return ret_ref;
70246 }
70247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70248         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
70249         int64_t ret_conv = Event_clone_ptr(arg_conv);
70250         return ret_conv;
70251 }
70252
70253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70254         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
70255         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70256         *ret_copy = Event_clone(orig_conv);
70257         int64_t ret_ref = tag_ptr(ret_copy, true);
70258         return ret_ref;
70259 }
70260
70261 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) {
70262         LDKThirtyTwoBytes temporary_channel_id_ref;
70263         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
70264         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
70265         LDKPublicKey counterparty_node_id_ref;
70266         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70267         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70268         LDKCVec_u8Z output_script_ref;
70269         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
70270         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
70271         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
70272         LDKU128 user_channel_id_ref;
70273         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70274         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70275         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70276         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
70277         int64_t ret_ref = tag_ptr(ret_copy, true);
70278         return ret_ref;
70279 }
70280
70281 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) {
70282         LDKPublicKey receiver_node_id_ref;
70283         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
70284         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
70285         LDKThirtyTwoBytes payment_hash_ref;
70286         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70287         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70288         LDKRecipientOnionFields onion_fields_conv;
70289         onion_fields_conv.inner = untag_ptr(onion_fields);
70290         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
70291         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
70292         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
70293         void* purpose_ptr = untag_ptr(purpose);
70294         CHECK_ACCESS(purpose_ptr);
70295         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
70296         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
70297         void* via_channel_id_ptr = untag_ptr(via_channel_id);
70298         CHECK_ACCESS(via_channel_id_ptr);
70299         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
70300         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
70301         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
70302         CHECK_ACCESS(via_user_channel_id_ptr);
70303         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
70304         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
70305         void* claim_deadline_ptr = untag_ptr(claim_deadline);
70306         CHECK_ACCESS(claim_deadline_ptr);
70307         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
70308         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
70309         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70310         *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);
70311         int64_t ret_ref = tag_ptr(ret_copy, true);
70312         return ret_ref;
70313 }
70314
70315 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) {
70316         LDKPublicKey receiver_node_id_ref;
70317         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
70318         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
70319         LDKThirtyTwoBytes payment_hash_ref;
70320         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70321         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70322         void* purpose_ptr = untag_ptr(purpose);
70323         CHECK_ACCESS(purpose_ptr);
70324         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
70325         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
70326         LDKCVec_ClaimedHTLCZ htlcs_constr;
70327         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
70328         if (htlcs_constr.datalen > 0)
70329                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
70330         else
70331                 htlcs_constr.data = NULL;
70332         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
70333         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
70334                 int64_t htlcs_conv_13 = htlcs_vals[n];
70335                 LDKClaimedHTLC htlcs_conv_13_conv;
70336                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
70337                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
70338                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
70339                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
70340                 htlcs_constr.data[n] = htlcs_conv_13_conv;
70341         }
70342         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
70343         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
70344         CHECK_ACCESS(sender_intended_total_msat_ptr);
70345         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
70346         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
70347         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70348         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
70349         int64_t ret_ref = tag_ptr(ret_copy, true);
70350         return ret_ref;
70351 }
70352
70353 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) {
70354         void* payment_id_ptr = untag_ptr(payment_id);
70355         CHECK_ACCESS(payment_id_ptr);
70356         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
70357         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
70358         LDKThirtyTwoBytes payment_preimage_ref;
70359         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
70360         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
70361         LDKThirtyTwoBytes payment_hash_ref;
70362         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70363         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70364         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
70365         CHECK_ACCESS(fee_paid_msat_ptr);
70366         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
70367         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
70368         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70369         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
70370         int64_t ret_ref = tag_ptr(ret_copy, true);
70371         return ret_ref;
70372 }
70373
70374 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) {
70375         LDKThirtyTwoBytes payment_id_ref;
70376         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70377         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70378         LDKThirtyTwoBytes payment_hash_ref;
70379         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70380         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70381         void* reason_ptr = untag_ptr(reason);
70382         CHECK_ACCESS(reason_ptr);
70383         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
70384         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
70385         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70386         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
70387         int64_t ret_ref = tag_ptr(ret_copy, true);
70388         return ret_ref;
70389 }
70390
70391 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) {
70392         LDKThirtyTwoBytes payment_id_ref;
70393         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70394         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70395         void* payment_hash_ptr = untag_ptr(payment_hash);
70396         CHECK_ACCESS(payment_hash_ptr);
70397         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
70398         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
70399         LDKPath path_conv;
70400         path_conv.inner = untag_ptr(path);
70401         path_conv.is_owned = ptr_is_owned(path);
70402         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70403         path_conv = Path_clone(&path_conv);
70404         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70405         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
70406         int64_t ret_ref = tag_ptr(ret_copy, true);
70407         return ret_ref;
70408 }
70409
70410 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) {
70411         void* payment_id_ptr = untag_ptr(payment_id);
70412         CHECK_ACCESS(payment_id_ptr);
70413         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
70414         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
70415         LDKThirtyTwoBytes payment_hash_ref;
70416         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70417         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70418         void* failure_ptr = untag_ptr(failure);
70419         CHECK_ACCESS(failure_ptr);
70420         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
70421         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
70422         LDKPath path_conv;
70423         path_conv.inner = untag_ptr(path);
70424         path_conv.is_owned = ptr_is_owned(path);
70425         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70426         path_conv = Path_clone(&path_conv);
70427         void* short_channel_id_ptr = untag_ptr(short_channel_id);
70428         CHECK_ACCESS(short_channel_id_ptr);
70429         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
70430         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
70431         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70432         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
70433         int64_t ret_ref = tag_ptr(ret_copy, true);
70434         return ret_ref;
70435 }
70436
70437 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) {
70438         LDKThirtyTwoBytes payment_id_ref;
70439         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70440         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70441         LDKThirtyTwoBytes payment_hash_ref;
70442         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70443         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70444         LDKPath path_conv;
70445         path_conv.inner = untag_ptr(path);
70446         path_conv.is_owned = ptr_is_owned(path);
70447         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70448         path_conv = Path_clone(&path_conv);
70449         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70450         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
70451         int64_t ret_ref = tag_ptr(ret_copy, true);
70452         return ret_ref;
70453 }
70454
70455 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) {
70456         LDKThirtyTwoBytes payment_id_ref;
70457         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70458         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70459         LDKThirtyTwoBytes payment_hash_ref;
70460         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70461         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70462         LDKPath path_conv;
70463         path_conv.inner = untag_ptr(path);
70464         path_conv.is_owned = ptr_is_owned(path);
70465         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70466         path_conv = Path_clone(&path_conv);
70467         void* short_channel_id_ptr = untag_ptr(short_channel_id);
70468         CHECK_ACCESS(short_channel_id_ptr);
70469         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
70470         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
70471         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70472         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
70473         int64_t ret_ref = tag_ptr(ret_copy, true);
70474         return ret_ref;
70475 }
70476
70477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
70478         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70479         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
70480         int64_t ret_ref = tag_ptr(ret_copy, true);
70481         return ret_ref;
70482 }
70483
70484 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) {
70485         LDKThirtyTwoBytes intercept_id_ref;
70486         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
70487         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
70488         LDKThirtyTwoBytes payment_hash_ref;
70489         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70490         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70491         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70492         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
70493         int64_t ret_ref = tag_ptr(ret_copy, true);
70494         return ret_ref;
70495 }
70496
70497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
70498         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
70499         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
70500         if (outputs_constr.datalen > 0)
70501                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
70502         else
70503                 outputs_constr.data = NULL;
70504         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
70505         for (size_t b = 0; b < outputs_constr.datalen; b++) {
70506                 int64_t outputs_conv_27 = outputs_vals[b];
70507                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
70508                 CHECK_ACCESS(outputs_conv_27_ptr);
70509                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
70510                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
70511                 outputs_constr.data[b] = outputs_conv_27_conv;
70512         }
70513         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
70514         void* channel_id_ptr = untag_ptr(channel_id);
70515         CHECK_ACCESS(channel_id_ptr);
70516         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
70517         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
70518         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70519         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
70520         int64_t ret_ref = tag_ptr(ret_copy, true);
70521         return ret_ref;
70522 }
70523
70524 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) {
70525         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
70526         CHECK_ACCESS(prev_channel_id_ptr);
70527         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
70528         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
70529         void* next_channel_id_ptr = untag_ptr(next_channel_id);
70530         CHECK_ACCESS(next_channel_id_ptr);
70531         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
70532         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
70533         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
70534         CHECK_ACCESS(fee_earned_msat_ptr);
70535         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
70536         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
70537         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
70538         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
70539         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
70540         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
70541         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70542         *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);
70543         int64_t ret_ref = tag_ptr(ret_copy, true);
70544         return ret_ref;
70545 }
70546
70547 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) {
70548         LDKThirtyTwoBytes channel_id_ref;
70549         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70550         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70551         LDKU128 user_channel_id_ref;
70552         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70553         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70554         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
70555         CHECK_ACCESS(former_temporary_channel_id_ptr);
70556         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
70557         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
70558         LDKPublicKey counterparty_node_id_ref;
70559         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70560         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70561         LDKOutPoint funding_txo_conv;
70562         funding_txo_conv.inner = untag_ptr(funding_txo);
70563         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
70564         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
70565         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
70566         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70567         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
70568         int64_t ret_ref = tag_ptr(ret_copy, true);
70569         return ret_ref;
70570 }
70571
70572 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) {
70573         LDKThirtyTwoBytes channel_id_ref;
70574         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70575         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70576         LDKU128 user_channel_id_ref;
70577         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70578         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70579         LDKPublicKey counterparty_node_id_ref;
70580         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70581         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70582         LDKChannelTypeFeatures channel_type_conv;
70583         channel_type_conv.inner = untag_ptr(channel_type);
70584         channel_type_conv.is_owned = ptr_is_owned(channel_type);
70585         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
70586         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
70587         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70588         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
70589         int64_t ret_ref = tag_ptr(ret_copy, true);
70590         return ret_ref;
70591 }
70592
70593 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) {
70594         LDKThirtyTwoBytes channel_id_ref;
70595         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70596         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70597         LDKU128 user_channel_id_ref;
70598         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70599         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70600         void* reason_ptr = untag_ptr(reason);
70601         CHECK_ACCESS(reason_ptr);
70602         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
70603         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
70604         LDKPublicKey counterparty_node_id_ref;
70605         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70606         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70607         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
70608         CHECK_ACCESS(channel_capacity_sats_ptr);
70609         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
70610         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
70611         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70612         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
70613         int64_t ret_ref = tag_ptr(ret_copy, true);
70614         return ret_ref;
70615 }
70616
70617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
70618         LDKThirtyTwoBytes channel_id_ref;
70619         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70620         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70621         LDKTransaction transaction_ref;
70622         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
70623         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
70624         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
70625         transaction_ref.data_is_owned = true;
70626         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70627         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
70628         int64_t ret_ref = tag_ptr(ret_copy, true);
70629         return ret_ref;
70630 }
70631
70632 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) {
70633         LDKThirtyTwoBytes temporary_channel_id_ref;
70634         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
70635         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
70636         LDKPublicKey counterparty_node_id_ref;
70637         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70638         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70639         LDKChannelTypeFeatures channel_type_conv;
70640         channel_type_conv.inner = untag_ptr(channel_type);
70641         channel_type_conv.is_owned = ptr_is_owned(channel_type);
70642         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
70643         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
70644         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70645         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
70646         int64_t ret_ref = tag_ptr(ret_copy, true);
70647         return ret_ref;
70648 }
70649
70650 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) {
70651         LDKThirtyTwoBytes prev_channel_id_ref;
70652         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
70653         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
70654         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
70655         CHECK_ACCESS(failed_next_destination_ptr);
70656         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
70657         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
70658         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70659         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
70660         int64_t ret_ref = tag_ptr(ret_copy, true);
70661         return ret_ref;
70662 }
70663
70664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
70665         void* a_ptr = untag_ptr(a);
70666         CHECK_ACCESS(a_ptr);
70667         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
70668         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
70669         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70670         *ret_copy = Event_bump_transaction(a_conv);
70671         int64_t ret_ref = tag_ptr(ret_copy, true);
70672         return ret_ref;
70673 }
70674
70675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70676         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
70677         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
70678         jboolean ret_conv = Event_eq(a_conv, b_conv);
70679         return ret_conv;
70680 }
70681
70682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
70683         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
70684         LDKCVec_u8Z ret_var = Event_write(obj_conv);
70685         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70686         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70687         CVec_u8Z_free(ret_var);
70688         return ret_arr;
70689 }
70690
70691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70692         LDKu8slice ser_ref;
70693         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70694         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70695         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
70696         *ret_conv = Event_read(ser_ref);
70697         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70698         return tag_ptr(ret_conv, true);
70699 }
70700
70701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70702         if (!ptr_is_owned(this_ptr)) return;
70703         void* this_ptr_ptr = untag_ptr(this_ptr);
70704         CHECK_ACCESS(this_ptr_ptr);
70705         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
70706         FREE(untag_ptr(this_ptr));
70707         MessageSendEvent_free(this_ptr_conv);
70708 }
70709
70710 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
70711         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70712         *ret_copy = MessageSendEvent_clone(arg);
70713         int64_t ret_ref = tag_ptr(ret_copy, true);
70714         return ret_ref;
70715 }
70716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70717         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
70718         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
70719         return ret_conv;
70720 }
70721
70722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70723         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
70724         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70725         *ret_copy = MessageSendEvent_clone(orig_conv);
70726         int64_t ret_ref = tag_ptr(ret_copy, true);
70727         return ret_ref;
70728 }
70729
70730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70731         LDKPublicKey node_id_ref;
70732         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70733         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70734         LDKAcceptChannel msg_conv;
70735         msg_conv.inner = untag_ptr(msg);
70736         msg_conv.is_owned = ptr_is_owned(msg);
70737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70738         msg_conv = AcceptChannel_clone(&msg_conv);
70739         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70740         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
70741         int64_t ret_ref = tag_ptr(ret_copy, true);
70742         return ret_ref;
70743 }
70744
70745 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) {
70746         LDKPublicKey node_id_ref;
70747         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70748         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70749         LDKAcceptChannelV2 msg_conv;
70750         msg_conv.inner = untag_ptr(msg);
70751         msg_conv.is_owned = ptr_is_owned(msg);
70752         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70753         msg_conv = AcceptChannelV2_clone(&msg_conv);
70754         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70755         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
70756         int64_t ret_ref = tag_ptr(ret_copy, true);
70757         return ret_ref;
70758 }
70759
70760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70761         LDKPublicKey node_id_ref;
70762         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70763         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70764         LDKOpenChannel msg_conv;
70765         msg_conv.inner = untag_ptr(msg);
70766         msg_conv.is_owned = ptr_is_owned(msg);
70767         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70768         msg_conv = OpenChannel_clone(&msg_conv);
70769         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70770         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
70771         int64_t ret_ref = tag_ptr(ret_copy, true);
70772         return ret_ref;
70773 }
70774
70775 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) {
70776         LDKPublicKey node_id_ref;
70777         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70778         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70779         LDKOpenChannelV2 msg_conv;
70780         msg_conv.inner = untag_ptr(msg);
70781         msg_conv.is_owned = ptr_is_owned(msg);
70782         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70783         msg_conv = OpenChannelV2_clone(&msg_conv);
70784         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70785         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
70786         int64_t ret_ref = tag_ptr(ret_copy, true);
70787         return ret_ref;
70788 }
70789
70790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70791         LDKPublicKey node_id_ref;
70792         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70793         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70794         LDKFundingCreated msg_conv;
70795         msg_conv.inner = untag_ptr(msg);
70796         msg_conv.is_owned = ptr_is_owned(msg);
70797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70798         msg_conv = FundingCreated_clone(&msg_conv);
70799         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70800         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
70801         int64_t ret_ref = tag_ptr(ret_copy, true);
70802         return ret_ref;
70803 }
70804
70805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70806         LDKPublicKey node_id_ref;
70807         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70808         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70809         LDKFundingSigned msg_conv;
70810         msg_conv.inner = untag_ptr(msg);
70811         msg_conv.is_owned = ptr_is_owned(msg);
70812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70813         msg_conv = FundingSigned_clone(&msg_conv);
70814         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70815         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
70816         int64_t ret_ref = tag_ptr(ret_copy, true);
70817         return ret_ref;
70818 }
70819
70820 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) {
70821         LDKPublicKey node_id_ref;
70822         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70823         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70824         LDKTxAddInput msg_conv;
70825         msg_conv.inner = untag_ptr(msg);
70826         msg_conv.is_owned = ptr_is_owned(msg);
70827         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70828         msg_conv = TxAddInput_clone(&msg_conv);
70829         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70830         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
70831         int64_t ret_ref = tag_ptr(ret_copy, true);
70832         return ret_ref;
70833 }
70834
70835 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) {
70836         LDKPublicKey node_id_ref;
70837         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70838         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70839         LDKTxAddOutput msg_conv;
70840         msg_conv.inner = untag_ptr(msg);
70841         msg_conv.is_owned = ptr_is_owned(msg);
70842         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70843         msg_conv = TxAddOutput_clone(&msg_conv);
70844         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70845         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
70846         int64_t ret_ref = tag_ptr(ret_copy, true);
70847         return ret_ref;
70848 }
70849
70850 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) {
70851         LDKPublicKey node_id_ref;
70852         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70853         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70854         LDKTxRemoveInput msg_conv;
70855         msg_conv.inner = untag_ptr(msg);
70856         msg_conv.is_owned = ptr_is_owned(msg);
70857         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70858         msg_conv = TxRemoveInput_clone(&msg_conv);
70859         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70860         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
70861         int64_t ret_ref = tag_ptr(ret_copy, true);
70862         return ret_ref;
70863 }
70864
70865 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) {
70866         LDKPublicKey node_id_ref;
70867         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70868         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70869         LDKTxRemoveOutput msg_conv;
70870         msg_conv.inner = untag_ptr(msg);
70871         msg_conv.is_owned = ptr_is_owned(msg);
70872         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70873         msg_conv = TxRemoveOutput_clone(&msg_conv);
70874         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70875         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
70876         int64_t ret_ref = tag_ptr(ret_copy, true);
70877         return ret_ref;
70878 }
70879
70880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70881         LDKPublicKey node_id_ref;
70882         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70883         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70884         LDKTxComplete msg_conv;
70885         msg_conv.inner = untag_ptr(msg);
70886         msg_conv.is_owned = ptr_is_owned(msg);
70887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70888         msg_conv = TxComplete_clone(&msg_conv);
70889         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70890         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
70891         int64_t ret_ref = tag_ptr(ret_copy, true);
70892         return ret_ref;
70893 }
70894
70895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70896         LDKPublicKey node_id_ref;
70897         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70898         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70899         LDKTxSignatures msg_conv;
70900         msg_conv.inner = untag_ptr(msg);
70901         msg_conv.is_owned = ptr_is_owned(msg);
70902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70903         msg_conv = TxSignatures_clone(&msg_conv);
70904         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70905         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
70906         int64_t ret_ref = tag_ptr(ret_copy, true);
70907         return ret_ref;
70908 }
70909
70910 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) {
70911         LDKPublicKey node_id_ref;
70912         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70913         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70914         LDKTxInitRbf msg_conv;
70915         msg_conv.inner = untag_ptr(msg);
70916         msg_conv.is_owned = ptr_is_owned(msg);
70917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70918         msg_conv = TxInitRbf_clone(&msg_conv);
70919         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70920         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
70921         int64_t ret_ref = tag_ptr(ret_copy, true);
70922         return ret_ref;
70923 }
70924
70925 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) {
70926         LDKPublicKey node_id_ref;
70927         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70928         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70929         LDKTxAckRbf msg_conv;
70930         msg_conv.inner = untag_ptr(msg);
70931         msg_conv.is_owned = ptr_is_owned(msg);
70932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70933         msg_conv = TxAckRbf_clone(&msg_conv);
70934         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70935         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
70936         int64_t ret_ref = tag_ptr(ret_copy, true);
70937         return ret_ref;
70938 }
70939
70940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70941         LDKPublicKey node_id_ref;
70942         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70943         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70944         LDKTxAbort msg_conv;
70945         msg_conv.inner = untag_ptr(msg);
70946         msg_conv.is_owned = ptr_is_owned(msg);
70947         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70948         msg_conv = TxAbort_clone(&msg_conv);
70949         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70950         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
70951         int64_t ret_ref = tag_ptr(ret_copy, true);
70952         return ret_ref;
70953 }
70954
70955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70956         LDKPublicKey node_id_ref;
70957         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70958         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70959         LDKChannelReady msg_conv;
70960         msg_conv.inner = untag_ptr(msg);
70961         msg_conv.is_owned = ptr_is_owned(msg);
70962         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70963         msg_conv = ChannelReady_clone(&msg_conv);
70964         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70965         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
70966         int64_t ret_ref = tag_ptr(ret_copy, true);
70967         return ret_ref;
70968 }
70969
70970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70971         LDKPublicKey node_id_ref;
70972         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70973         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70974         LDKAnnouncementSignatures msg_conv;
70975         msg_conv.inner = untag_ptr(msg);
70976         msg_conv.is_owned = ptr_is_owned(msg);
70977         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70978         msg_conv = AnnouncementSignatures_clone(&msg_conv);
70979         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70980         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
70981         int64_t ret_ref = tag_ptr(ret_copy, true);
70982         return ret_ref;
70983 }
70984
70985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
70986         LDKPublicKey node_id_ref;
70987         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70988         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70989         LDKCommitmentUpdate updates_conv;
70990         updates_conv.inner = untag_ptr(updates);
70991         updates_conv.is_owned = ptr_is_owned(updates);
70992         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
70993         updates_conv = CommitmentUpdate_clone(&updates_conv);
70994         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70995         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
70996         int64_t ret_ref = tag_ptr(ret_copy, true);
70997         return ret_ref;
70998 }
70999
71000 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) {
71001         LDKPublicKey node_id_ref;
71002         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71003         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71004         LDKRevokeAndACK msg_conv;
71005         msg_conv.inner = untag_ptr(msg);
71006         msg_conv.is_owned = ptr_is_owned(msg);
71007         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71008         msg_conv = RevokeAndACK_clone(&msg_conv);
71009         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71010         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
71011         int64_t ret_ref = tag_ptr(ret_copy, true);
71012         return ret_ref;
71013 }
71014
71015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71016         LDKPublicKey node_id_ref;
71017         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71018         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71019         LDKClosingSigned msg_conv;
71020         msg_conv.inner = untag_ptr(msg);
71021         msg_conv.is_owned = ptr_is_owned(msg);
71022         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71023         msg_conv = ClosingSigned_clone(&msg_conv);
71024         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71025         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
71026         int64_t ret_ref = tag_ptr(ret_copy, true);
71027         return ret_ref;
71028 }
71029
71030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71031         LDKPublicKey node_id_ref;
71032         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71033         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71034         LDKShutdown msg_conv;
71035         msg_conv.inner = untag_ptr(msg);
71036         msg_conv.is_owned = ptr_is_owned(msg);
71037         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71038         msg_conv = Shutdown_clone(&msg_conv);
71039         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71040         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
71041         int64_t ret_ref = tag_ptr(ret_copy, true);
71042         return ret_ref;
71043 }
71044
71045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71046         LDKPublicKey node_id_ref;
71047         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71048         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71049         LDKChannelReestablish msg_conv;
71050         msg_conv.inner = untag_ptr(msg);
71051         msg_conv.is_owned = ptr_is_owned(msg);
71052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71053         msg_conv = ChannelReestablish_clone(&msg_conv);
71054         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71055         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
71056         int64_t ret_ref = tag_ptr(ret_copy, true);
71057         return ret_ref;
71058 }
71059
71060 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) {
71061         LDKPublicKey node_id_ref;
71062         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71063         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71064         LDKChannelAnnouncement msg_conv;
71065         msg_conv.inner = untag_ptr(msg);
71066         msg_conv.is_owned = ptr_is_owned(msg);
71067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71068         msg_conv = ChannelAnnouncement_clone(&msg_conv);
71069         LDKChannelUpdate update_msg_conv;
71070         update_msg_conv.inner = untag_ptr(update_msg);
71071         update_msg_conv.is_owned = ptr_is_owned(update_msg);
71072         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
71073         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
71074         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71075         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
71076         int64_t ret_ref = tag_ptr(ret_copy, true);
71077         return ret_ref;
71078 }
71079
71080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
71081         LDKChannelAnnouncement msg_conv;
71082         msg_conv.inner = untag_ptr(msg);
71083         msg_conv.is_owned = ptr_is_owned(msg);
71084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71085         msg_conv = ChannelAnnouncement_clone(&msg_conv);
71086         LDKChannelUpdate update_msg_conv;
71087         update_msg_conv.inner = untag_ptr(update_msg);
71088         update_msg_conv.is_owned = ptr_is_owned(update_msg);
71089         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
71090         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
71091         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71092         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
71093         int64_t ret_ref = tag_ptr(ret_copy, true);
71094         return ret_ref;
71095 }
71096
71097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
71098         LDKChannelUpdate msg_conv;
71099         msg_conv.inner = untag_ptr(msg);
71100         msg_conv.is_owned = ptr_is_owned(msg);
71101         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71102         msg_conv = ChannelUpdate_clone(&msg_conv);
71103         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71104         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
71105         int64_t ret_ref = tag_ptr(ret_copy, true);
71106         return ret_ref;
71107 }
71108
71109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
71110         LDKNodeAnnouncement msg_conv;
71111         msg_conv.inner = untag_ptr(msg);
71112         msg_conv.is_owned = ptr_is_owned(msg);
71113         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71114         msg_conv = NodeAnnouncement_clone(&msg_conv);
71115         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71116         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
71117         int64_t ret_ref = tag_ptr(ret_copy, true);
71118         return ret_ref;
71119 }
71120
71121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71122         LDKPublicKey node_id_ref;
71123         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71124         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71125         LDKChannelUpdate msg_conv;
71126         msg_conv.inner = untag_ptr(msg);
71127         msg_conv.is_owned = ptr_is_owned(msg);
71128         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71129         msg_conv = ChannelUpdate_clone(&msg_conv);
71130         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71131         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
71132         int64_t ret_ref = tag_ptr(ret_copy, true);
71133         return ret_ref;
71134 }
71135
71136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
71137         LDKPublicKey node_id_ref;
71138         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71139         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71140         void* action_ptr = untag_ptr(action);
71141         CHECK_ACCESS(action_ptr);
71142         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
71143         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
71144         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71145         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
71146         int64_t ret_ref = tag_ptr(ret_copy, true);
71147         return ret_ref;
71148 }
71149
71150 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) {
71151         LDKPublicKey node_id_ref;
71152         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71153         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71154         LDKQueryChannelRange msg_conv;
71155         msg_conv.inner = untag_ptr(msg);
71156         msg_conv.is_owned = ptr_is_owned(msg);
71157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71158         msg_conv = QueryChannelRange_clone(&msg_conv);
71159         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71160         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
71161         int64_t ret_ref = tag_ptr(ret_copy, true);
71162         return ret_ref;
71163 }
71164
71165 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) {
71166         LDKPublicKey node_id_ref;
71167         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71168         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71169         LDKQueryShortChannelIds msg_conv;
71170         msg_conv.inner = untag_ptr(msg);
71171         msg_conv.is_owned = ptr_is_owned(msg);
71172         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71173         msg_conv = QueryShortChannelIds_clone(&msg_conv);
71174         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71175         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
71176         int64_t ret_ref = tag_ptr(ret_copy, true);
71177         return ret_ref;
71178 }
71179
71180 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) {
71181         LDKPublicKey node_id_ref;
71182         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71183         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71184         LDKReplyChannelRange msg_conv;
71185         msg_conv.inner = untag_ptr(msg);
71186         msg_conv.is_owned = ptr_is_owned(msg);
71187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71188         msg_conv = ReplyChannelRange_clone(&msg_conv);
71189         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71190         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
71191         int64_t ret_ref = tag_ptr(ret_copy, true);
71192         return ret_ref;
71193 }
71194
71195 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) {
71196         LDKPublicKey node_id_ref;
71197         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71198         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71199         LDKGossipTimestampFilter msg_conv;
71200         msg_conv.inner = untag_ptr(msg);
71201         msg_conv.is_owned = ptr_is_owned(msg);
71202         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71203         msg_conv = GossipTimestampFilter_clone(&msg_conv);
71204         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71205         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
71206         int64_t ret_ref = tag_ptr(ret_copy, true);
71207         return ret_ref;
71208 }
71209
71210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71211         if (!ptr_is_owned(this_ptr)) return;
71212         void* this_ptr_ptr = untag_ptr(this_ptr);
71213         CHECK_ACCESS(this_ptr_ptr);
71214         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
71215         FREE(untag_ptr(this_ptr));
71216         MessageSendEventsProvider_free(this_ptr_conv);
71217 }
71218
71219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71220         if (!ptr_is_owned(this_ptr)) return;
71221         void* this_ptr_ptr = untag_ptr(this_ptr);
71222         CHECK_ACCESS(this_ptr_ptr);
71223         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
71224         FREE(untag_ptr(this_ptr));
71225         OnionMessageProvider_free(this_ptr_conv);
71226 }
71227
71228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71229         if (!ptr_is_owned(this_ptr)) return;
71230         void* this_ptr_ptr = untag_ptr(this_ptr);
71231         CHECK_ACCESS(this_ptr_ptr);
71232         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
71233         FREE(untag_ptr(this_ptr));
71234         EventsProvider_free(this_ptr_conv);
71235 }
71236
71237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71238         if (!ptr_is_owned(this_ptr)) return;
71239         void* this_ptr_ptr = untag_ptr(this_ptr);
71240         CHECK_ACCESS(this_ptr_ptr);
71241         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
71242         FREE(untag_ptr(this_ptr));
71243         EventHandler_free(this_ptr_conv);
71244 }
71245
71246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71247         LDKChannelDerivationParameters this_obj_conv;
71248         this_obj_conv.inner = untag_ptr(this_obj);
71249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71251         ChannelDerivationParameters_free(this_obj_conv);
71252 }
71253
71254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
71255         LDKChannelDerivationParameters this_ptr_conv;
71256         this_ptr_conv.inner = untag_ptr(this_ptr);
71257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71259         this_ptr_conv.is_owned = false;
71260         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
71261         return ret_conv;
71262 }
71263
71264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71265         LDKChannelDerivationParameters this_ptr_conv;
71266         this_ptr_conv.inner = untag_ptr(this_ptr);
71267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71269         this_ptr_conv.is_owned = false;
71270         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
71271 }
71272
71273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71274         LDKChannelDerivationParameters this_ptr_conv;
71275         this_ptr_conv.inner = untag_ptr(this_ptr);
71276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71278         this_ptr_conv.is_owned = false;
71279         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
71280         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
71281         return ret_arr;
71282 }
71283
71284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71285         LDKChannelDerivationParameters this_ptr_conv;
71286         this_ptr_conv.inner = untag_ptr(this_ptr);
71287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71289         this_ptr_conv.is_owned = false;
71290         LDKThirtyTwoBytes val_ref;
71291         CHECK((*env)->GetArrayLength(env, val) == 32);
71292         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
71293         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
71294 }
71295
71296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
71297         LDKChannelDerivationParameters this_ptr_conv;
71298         this_ptr_conv.inner = untag_ptr(this_ptr);
71299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71301         this_ptr_conv.is_owned = false;
71302         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
71303         int64_t ret_ref = 0;
71304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71306         return ret_ref;
71307 }
71308
71309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71310         LDKChannelDerivationParameters this_ptr_conv;
71311         this_ptr_conv.inner = untag_ptr(this_ptr);
71312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71314         this_ptr_conv.is_owned = false;
71315         LDKChannelTransactionParameters val_conv;
71316         val_conv.inner = untag_ptr(val);
71317         val_conv.is_owned = ptr_is_owned(val);
71318         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71319         val_conv = ChannelTransactionParameters_clone(&val_conv);
71320         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
71321 }
71322
71323 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) {
71324         LDKThirtyTwoBytes keys_id_arg_ref;
71325         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
71326         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
71327         LDKChannelTransactionParameters transaction_parameters_arg_conv;
71328         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
71329         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
71330         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
71331         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
71332         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
71333         int64_t ret_ref = 0;
71334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71336         return ret_ref;
71337 }
71338
71339 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
71340         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
71341         int64_t ret_ref = 0;
71342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71344         return ret_ref;
71345 }
71346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71347         LDKChannelDerivationParameters arg_conv;
71348         arg_conv.inner = untag_ptr(arg);
71349         arg_conv.is_owned = ptr_is_owned(arg);
71350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71351         arg_conv.is_owned = false;
71352         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
71353         return ret_conv;
71354 }
71355
71356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71357         LDKChannelDerivationParameters orig_conv;
71358         orig_conv.inner = untag_ptr(orig);
71359         orig_conv.is_owned = ptr_is_owned(orig);
71360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71361         orig_conv.is_owned = false;
71362         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
71363         int64_t ret_ref = 0;
71364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71366         return ret_ref;
71367 }
71368
71369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71370         LDKChannelDerivationParameters a_conv;
71371         a_conv.inner = untag_ptr(a);
71372         a_conv.is_owned = ptr_is_owned(a);
71373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71374         a_conv.is_owned = false;
71375         LDKChannelDerivationParameters b_conv;
71376         b_conv.inner = untag_ptr(b);
71377         b_conv.is_owned = ptr_is_owned(b);
71378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71379         b_conv.is_owned = false;
71380         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
71381         return ret_conv;
71382 }
71383
71384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
71385         LDKChannelDerivationParameters obj_conv;
71386         obj_conv.inner = untag_ptr(obj);
71387         obj_conv.is_owned = ptr_is_owned(obj);
71388         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71389         obj_conv.is_owned = false;
71390         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
71391         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71392         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71393         CVec_u8Z_free(ret_var);
71394         return ret_arr;
71395 }
71396
71397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71398         LDKu8slice ser_ref;
71399         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71400         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71401         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
71402         *ret_conv = ChannelDerivationParameters_read(ser_ref);
71403         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71404         return tag_ptr(ret_conv, true);
71405 }
71406
71407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71408         LDKAnchorDescriptor this_obj_conv;
71409         this_obj_conv.inner = untag_ptr(this_obj);
71410         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71412         AnchorDescriptor_free(this_obj_conv);
71413 }
71414
71415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
71416         LDKAnchorDescriptor this_ptr_conv;
71417         this_ptr_conv.inner = untag_ptr(this_ptr);
71418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71420         this_ptr_conv.is_owned = false;
71421         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
71422         int64_t ret_ref = 0;
71423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71425         return ret_ref;
71426 }
71427
71428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71429         LDKAnchorDescriptor this_ptr_conv;
71430         this_ptr_conv.inner = untag_ptr(this_ptr);
71431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71433         this_ptr_conv.is_owned = false;
71434         LDKChannelDerivationParameters val_conv;
71435         val_conv.inner = untag_ptr(val);
71436         val_conv.is_owned = ptr_is_owned(val);
71437         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71438         val_conv = ChannelDerivationParameters_clone(&val_conv);
71439         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
71440 }
71441
71442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
71443         LDKAnchorDescriptor 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         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
71449         int64_t ret_ref = 0;
71450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71452         return ret_ref;
71453 }
71454
71455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71456         LDKAnchorDescriptor this_ptr_conv;
71457         this_ptr_conv.inner = untag_ptr(this_ptr);
71458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71460         this_ptr_conv.is_owned = false;
71461         LDKOutPoint val_conv;
71462         val_conv.inner = untag_ptr(val);
71463         val_conv.is_owned = ptr_is_owned(val);
71464         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71465         val_conv = OutPoint_clone(&val_conv);
71466         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
71467 }
71468
71469 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) {
71470         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
71471         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
71472         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
71473         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
71474         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
71475         LDKOutPoint outpoint_arg_conv;
71476         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
71477         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
71478         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
71479         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
71480         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
71481         int64_t ret_ref = 0;
71482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71484         return ret_ref;
71485 }
71486
71487 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
71488         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
71489         int64_t ret_ref = 0;
71490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71492         return ret_ref;
71493 }
71494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71495         LDKAnchorDescriptor arg_conv;
71496         arg_conv.inner = untag_ptr(arg);
71497         arg_conv.is_owned = ptr_is_owned(arg);
71498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71499         arg_conv.is_owned = false;
71500         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
71501         return ret_conv;
71502 }
71503
71504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71505         LDKAnchorDescriptor orig_conv;
71506         orig_conv.inner = untag_ptr(orig);
71507         orig_conv.is_owned = ptr_is_owned(orig);
71508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71509         orig_conv.is_owned = false;
71510         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
71511         int64_t ret_ref = 0;
71512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71514         return ret_ref;
71515 }
71516
71517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71518         LDKAnchorDescriptor a_conv;
71519         a_conv.inner = untag_ptr(a);
71520         a_conv.is_owned = ptr_is_owned(a);
71521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71522         a_conv.is_owned = false;
71523         LDKAnchorDescriptor b_conv;
71524         b_conv.inner = untag_ptr(b);
71525         b_conv.is_owned = ptr_is_owned(b);
71526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71527         b_conv.is_owned = false;
71528         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
71529         return ret_conv;
71530 }
71531
71532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
71533         LDKAnchorDescriptor this_arg_conv;
71534         this_arg_conv.inner = untag_ptr(this_arg);
71535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71537         this_arg_conv.is_owned = false;
71538         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
71539         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
71540         return tag_ptr(ret_ref, true);
71541 }
71542
71543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
71544         LDKAnchorDescriptor this_arg_conv;
71545         this_arg_conv.inner = untag_ptr(this_arg);
71546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71548         this_arg_conv.is_owned = false;
71549         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
71550         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
71551         return tag_ptr(ret_ref, true);
71552 }
71553
71554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
71555         LDKAnchorDescriptor this_arg_conv;
71556         this_arg_conv.inner = untag_ptr(this_arg);
71557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71559         this_arg_conv.is_owned = false;
71560         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
71561         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71562         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71563         CVec_u8Z_free(ret_var);
71564         return ret_arr;
71565 }
71566
71567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
71568         LDKAnchorDescriptor this_arg_conv;
71569         this_arg_conv.inner = untag_ptr(this_arg);
71570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71572         this_arg_conv.is_owned = false;
71573         LDKECDSASignature signature_ref;
71574         CHECK((*env)->GetArrayLength(env, signature) == 64);
71575         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
71576         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
71577         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71578         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71579         Witness_free(ret_var);
71580         return ret_arr;
71581 }
71582
71583 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) {
71584         LDKAnchorDescriptor this_arg_conv;
71585         this_arg_conv.inner = untag_ptr(this_arg);
71586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71588         this_arg_conv.is_owned = false;
71589         void* signer_provider_ptr = untag_ptr(signer_provider);
71590         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
71591         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
71592         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
71593         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
71594         return tag_ptr(ret_ret, true);
71595 }
71596
71597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71598         LDKHTLCDescriptor this_obj_conv;
71599         this_obj_conv.inner = untag_ptr(this_obj);
71600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71602         HTLCDescriptor_free(this_obj_conv);
71603 }
71604
71605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
71606         LDKHTLCDescriptor this_ptr_conv;
71607         this_ptr_conv.inner = untag_ptr(this_ptr);
71608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71610         this_ptr_conv.is_owned = false;
71611         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
71612         int64_t ret_ref = 0;
71613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71615         return ret_ref;
71616 }
71617
71618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71619         LDKHTLCDescriptor this_ptr_conv;
71620         this_ptr_conv.inner = untag_ptr(this_ptr);
71621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71623         this_ptr_conv.is_owned = false;
71624         LDKChannelDerivationParameters val_conv;
71625         val_conv.inner = untag_ptr(val);
71626         val_conv.is_owned = ptr_is_owned(val);
71627         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71628         val_conv = ChannelDerivationParameters_clone(&val_conv);
71629         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
71630 }
71631
71632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
71633         LDKHTLCDescriptor this_ptr_conv;
71634         this_ptr_conv.inner = untag_ptr(this_ptr);
71635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71637         this_ptr_conv.is_owned = false;
71638         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
71639         return ret_conv;
71640 }
71641
71642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71643         LDKHTLCDescriptor this_ptr_conv;
71644         this_ptr_conv.inner = untag_ptr(this_ptr);
71645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71647         this_ptr_conv.is_owned = false;
71648         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
71649 }
71650
71651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
71652         LDKHTLCDescriptor this_ptr_conv;
71653         this_ptr_conv.inner = untag_ptr(this_ptr);
71654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71656         this_ptr_conv.is_owned = false;
71657         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71658         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
71659         return ret_arr;
71660 }
71661
71662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71663         LDKHTLCDescriptor this_ptr_conv;
71664         this_ptr_conv.inner = untag_ptr(this_ptr);
71665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71667         this_ptr_conv.is_owned = false;
71668         LDKPublicKey val_ref;
71669         CHECK((*env)->GetArrayLength(env, val) == 33);
71670         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
71671         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
71672 }
71673
71674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
71675         LDKHTLCDescriptor this_ptr_conv;
71676         this_ptr_conv.inner = untag_ptr(this_ptr);
71677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71679         this_ptr_conv.is_owned = false;
71680         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
71681         int64_t ret_ref = 0;
71682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71684         return ret_ref;
71685 }
71686
71687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71688         LDKHTLCDescriptor this_ptr_conv;
71689         this_ptr_conv.inner = untag_ptr(this_ptr);
71690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71692         this_ptr_conv.is_owned = false;
71693         LDKHTLCOutputInCommitment val_conv;
71694         val_conv.inner = untag_ptr(val);
71695         val_conv.is_owned = ptr_is_owned(val);
71696         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71697         val_conv = HTLCOutputInCommitment_clone(&val_conv);
71698         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
71699 }
71700
71701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
71702         LDKHTLCDescriptor this_ptr_conv;
71703         this_ptr_conv.inner = untag_ptr(this_ptr);
71704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71706         this_ptr_conv.is_owned = false;
71707         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
71708         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
71709         int64_t ret_ref = tag_ptr(ret_copy, true);
71710         return ret_ref;
71711 }
71712
71713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71714         LDKHTLCDescriptor this_ptr_conv;
71715         this_ptr_conv.inner = untag_ptr(this_ptr);
71716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71718         this_ptr_conv.is_owned = false;
71719         void* val_ptr = untag_ptr(val);
71720         CHECK_ACCESS(val_ptr);
71721         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
71722         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
71723         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
71724 }
71725
71726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
71727         LDKHTLCDescriptor this_ptr_conv;
71728         this_ptr_conv.inner = untag_ptr(this_ptr);
71729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71731         this_ptr_conv.is_owned = false;
71732         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
71733         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
71734         return ret_arr;
71735 }
71736
71737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71738         LDKHTLCDescriptor this_ptr_conv;
71739         this_ptr_conv.inner = untag_ptr(this_ptr);
71740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71742         this_ptr_conv.is_owned = false;
71743         LDKECDSASignature val_ref;
71744         CHECK((*env)->GetArrayLength(env, val) == 64);
71745         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
71746         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
71747 }
71748
71749 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
71750         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
71751         int64_t ret_ref = 0;
71752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71754         return ret_ref;
71755 }
71756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71757         LDKHTLCDescriptor arg_conv;
71758         arg_conv.inner = untag_ptr(arg);
71759         arg_conv.is_owned = ptr_is_owned(arg);
71760         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71761         arg_conv.is_owned = false;
71762         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
71763         return ret_conv;
71764 }
71765
71766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71767         LDKHTLCDescriptor orig_conv;
71768         orig_conv.inner = untag_ptr(orig);
71769         orig_conv.is_owned = ptr_is_owned(orig);
71770         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71771         orig_conv.is_owned = false;
71772         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
71773         int64_t ret_ref = 0;
71774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71776         return ret_ref;
71777 }
71778
71779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71780         LDKHTLCDescriptor a_conv;
71781         a_conv.inner = untag_ptr(a);
71782         a_conv.is_owned = ptr_is_owned(a);
71783         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71784         a_conv.is_owned = false;
71785         LDKHTLCDescriptor b_conv;
71786         b_conv.inner = untag_ptr(b);
71787         b_conv.is_owned = ptr_is_owned(b);
71788         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71789         b_conv.is_owned = false;
71790         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
71791         return ret_conv;
71792 }
71793
71794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
71795         LDKHTLCDescriptor obj_conv;
71796         obj_conv.inner = untag_ptr(obj);
71797         obj_conv.is_owned = ptr_is_owned(obj);
71798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71799         obj_conv.is_owned = false;
71800         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
71801         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71802         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71803         CVec_u8Z_free(ret_var);
71804         return ret_arr;
71805 }
71806
71807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71808         LDKu8slice ser_ref;
71809         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71810         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71811         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
71812         *ret_conv = HTLCDescriptor_read(ser_ref);
71813         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71814         return tag_ptr(ret_conv, true);
71815 }
71816
71817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
71818         LDKHTLCDescriptor this_arg_conv;
71819         this_arg_conv.inner = untag_ptr(this_arg);
71820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71822         this_arg_conv.is_owned = false;
71823         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
71824         int64_t ret_ref = 0;
71825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71827         return ret_ref;
71828 }
71829
71830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
71831         LDKHTLCDescriptor this_arg_conv;
71832         this_arg_conv.inner = untag_ptr(this_arg);
71833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71835         this_arg_conv.is_owned = false;
71836         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
71837         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
71838         return tag_ptr(ret_ref, true);
71839 }
71840
71841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
71842         LDKHTLCDescriptor this_arg_conv;
71843         this_arg_conv.inner = untag_ptr(this_arg);
71844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71846         this_arg_conv.is_owned = false;
71847         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
71848         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
71849         return tag_ptr(ret_ref, true);
71850 }
71851
71852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
71853         LDKHTLCDescriptor this_arg_conv;
71854         this_arg_conv.inner = untag_ptr(this_arg);
71855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71857         this_arg_conv.is_owned = false;
71858         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
71859         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
71860         return tag_ptr(ret_ref, true);
71861 }
71862
71863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
71864         LDKHTLCDescriptor this_arg_conv;
71865         this_arg_conv.inner = untag_ptr(this_arg);
71866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71868         this_arg_conv.is_owned = false;
71869         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
71870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71872         CVec_u8Z_free(ret_var);
71873         return ret_arr;
71874 }
71875
71876 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) {
71877         LDKHTLCDescriptor this_arg_conv;
71878         this_arg_conv.inner = untag_ptr(this_arg);
71879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71881         this_arg_conv.is_owned = false;
71882         LDKECDSASignature signature_ref;
71883         CHECK((*env)->GetArrayLength(env, signature) == 64);
71884         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
71885         LDKu8slice witness_script_ref;
71886         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
71887         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
71888         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
71889         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71890         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71891         Witness_free(ret_var);
71892         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
71893         return ret_arr;
71894 }
71895
71896 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) {
71897         LDKHTLCDescriptor this_arg_conv;
71898         this_arg_conv.inner = untag_ptr(this_arg);
71899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71901         this_arg_conv.is_owned = false;
71902         void* signer_provider_ptr = untag_ptr(signer_provider);
71903         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
71904         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
71905         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
71906         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
71907         return tag_ptr(ret_ret, true);
71908 }
71909
71910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71911         if (!ptr_is_owned(this_ptr)) return;
71912         void* this_ptr_ptr = untag_ptr(this_ptr);
71913         CHECK_ACCESS(this_ptr_ptr);
71914         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
71915         FREE(untag_ptr(this_ptr));
71916         BumpTransactionEvent_free(this_ptr_conv);
71917 }
71918
71919 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
71920         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71921         *ret_copy = BumpTransactionEvent_clone(arg);
71922         int64_t ret_ref = tag_ptr(ret_copy, true);
71923         return ret_ref;
71924 }
71925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71926         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
71927         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
71928         return ret_conv;
71929 }
71930
71931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71932         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
71933         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71934         *ret_copy = BumpTransactionEvent_clone(orig_conv);
71935         int64_t ret_ref = tag_ptr(ret_copy, true);
71936         return ret_ref;
71937 }
71938
71939 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) {
71940         LDKThirtyTwoBytes claim_id_ref;
71941         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
71942         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
71943         LDKTransaction commitment_tx_ref;
71944         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
71945         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
71946         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
71947         commitment_tx_ref.data_is_owned = true;
71948         LDKAnchorDescriptor anchor_descriptor_conv;
71949         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
71950         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
71951         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
71952         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
71953         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
71954         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
71955         if (pending_htlcs_constr.datalen > 0)
71956                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
71957         else
71958                 pending_htlcs_constr.data = NULL;
71959         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
71960         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
71961                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
71962                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
71963                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
71964                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
71965                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
71966                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
71967                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
71968         }
71969         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
71970         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71971         *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);
71972         int64_t ret_ref = tag_ptr(ret_copy, true);
71973         return ret_ref;
71974 }
71975
71976 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) {
71977         LDKThirtyTwoBytes claim_id_ref;
71978         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
71979         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
71980         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
71981         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
71982         if (htlc_descriptors_constr.datalen > 0)
71983                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
71984         else
71985                 htlc_descriptors_constr.data = NULL;
71986         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
71987         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
71988                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
71989                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
71990                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
71991                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
71992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
71993                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
71994                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
71995         }
71996         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
71997         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71998         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
71999         int64_t ret_ref = tag_ptr(ret_copy, true);
72000         return ret_ref;
72001 }
72002
72003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72004         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
72005         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
72006         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
72007         return ret_conv;
72008 }
72009
72010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72011         LDKInput this_obj_conv;
72012         this_obj_conv.inner = untag_ptr(this_obj);
72013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72015         Input_free(this_obj_conv);
72016 }
72017
72018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72019         LDKInput this_ptr_conv;
72020         this_ptr_conv.inner = untag_ptr(this_ptr);
72021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72023         this_ptr_conv.is_owned = false;
72024         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
72025         int64_t ret_ref = 0;
72026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72028         return ret_ref;
72029 }
72030
72031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72032         LDKInput this_ptr_conv;
72033         this_ptr_conv.inner = untag_ptr(this_ptr);
72034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72036         this_ptr_conv.is_owned = false;
72037         LDKOutPoint val_conv;
72038         val_conv.inner = untag_ptr(val);
72039         val_conv.is_owned = ptr_is_owned(val);
72040         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72041         val_conv = OutPoint_clone(&val_conv);
72042         Input_set_outpoint(&this_ptr_conv, val_conv);
72043 }
72044
72045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
72046         LDKInput this_ptr_conv;
72047         this_ptr_conv.inner = untag_ptr(this_ptr);
72048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72050         this_ptr_conv.is_owned = false;
72051         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72052         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
72053         return tag_ptr(ret_ref, true);
72054 }
72055
72056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72057         LDKInput this_ptr_conv;
72058         this_ptr_conv.inner = untag_ptr(this_ptr);
72059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72061         this_ptr_conv.is_owned = false;
72062         void* val_ptr = untag_ptr(val);
72063         CHECK_ACCESS(val_ptr);
72064         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
72065         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
72066         Input_set_previous_utxo(&this_ptr_conv, val_conv);
72067 }
72068
72069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
72070         LDKInput this_ptr_conv;
72071         this_ptr_conv.inner = untag_ptr(this_ptr);
72072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72074         this_ptr_conv.is_owned = false;
72075         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
72076         return ret_conv;
72077 }
72078
72079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72080         LDKInput this_ptr_conv;
72081         this_ptr_conv.inner = untag_ptr(this_ptr);
72082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72084         this_ptr_conv.is_owned = false;
72085         Input_set_satisfaction_weight(&this_ptr_conv, val);
72086 }
72087
72088 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) {
72089         LDKOutPoint outpoint_arg_conv;
72090         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72091         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72092         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72093         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72094         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
72095         CHECK_ACCESS(previous_utxo_arg_ptr);
72096         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
72097         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
72098         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
72099         int64_t ret_ref = 0;
72100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72102         return ret_ref;
72103 }
72104
72105 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
72106         LDKInput ret_var = Input_clone(arg);
72107         int64_t ret_ref = 0;
72108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72110         return ret_ref;
72111 }
72112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72113         LDKInput arg_conv;
72114         arg_conv.inner = untag_ptr(arg);
72115         arg_conv.is_owned = ptr_is_owned(arg);
72116         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72117         arg_conv.is_owned = false;
72118         int64_t ret_conv = Input_clone_ptr(&arg_conv);
72119         return ret_conv;
72120 }
72121
72122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72123         LDKInput orig_conv;
72124         orig_conv.inner = untag_ptr(orig);
72125         orig_conv.is_owned = ptr_is_owned(orig);
72126         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72127         orig_conv.is_owned = false;
72128         LDKInput ret_var = Input_clone(&orig_conv);
72129         int64_t ret_ref = 0;
72130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72132         return ret_ref;
72133 }
72134
72135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
72136         LDKInput o_conv;
72137         o_conv.inner = untag_ptr(o);
72138         o_conv.is_owned = ptr_is_owned(o);
72139         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72140         o_conv.is_owned = false;
72141         int64_t ret_conv = Input_hash(&o_conv);
72142         return ret_conv;
72143 }
72144
72145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72146         LDKInput a_conv;
72147         a_conv.inner = untag_ptr(a);
72148         a_conv.is_owned = ptr_is_owned(a);
72149         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72150         a_conv.is_owned = false;
72151         LDKInput b_conv;
72152         b_conv.inner = untag_ptr(b);
72153         b_conv.is_owned = ptr_is_owned(b);
72154         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72155         b_conv.is_owned = false;
72156         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
72157         return ret_conv;
72158 }
72159
72160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72161         LDKUtxo this_obj_conv;
72162         this_obj_conv.inner = untag_ptr(this_obj);
72163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72165         Utxo_free(this_obj_conv);
72166 }
72167
72168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72169         LDKUtxo this_ptr_conv;
72170         this_ptr_conv.inner = untag_ptr(this_ptr);
72171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72173         this_ptr_conv.is_owned = false;
72174         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
72175         int64_t ret_ref = 0;
72176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72178         return ret_ref;
72179 }
72180
72181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72182         LDKUtxo this_ptr_conv;
72183         this_ptr_conv.inner = untag_ptr(this_ptr);
72184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72186         this_ptr_conv.is_owned = false;
72187         LDKOutPoint val_conv;
72188         val_conv.inner = untag_ptr(val);
72189         val_conv.is_owned = ptr_is_owned(val);
72190         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72191         val_conv = OutPoint_clone(&val_conv);
72192         Utxo_set_outpoint(&this_ptr_conv, val_conv);
72193 }
72194
72195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
72196         LDKUtxo this_ptr_conv;
72197         this_ptr_conv.inner = untag_ptr(this_ptr);
72198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72200         this_ptr_conv.is_owned = false;
72201         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72202         *ret_ref = Utxo_get_output(&this_ptr_conv);
72203         return tag_ptr(ret_ref, true);
72204 }
72205
72206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72207         LDKUtxo this_ptr_conv;
72208         this_ptr_conv.inner = untag_ptr(this_ptr);
72209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72211         this_ptr_conv.is_owned = false;
72212         void* val_ptr = untag_ptr(val);
72213         CHECK_ACCESS(val_ptr);
72214         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
72215         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
72216         Utxo_set_output(&this_ptr_conv, val_conv);
72217 }
72218
72219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
72220         LDKUtxo this_ptr_conv;
72221         this_ptr_conv.inner = untag_ptr(this_ptr);
72222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72224         this_ptr_conv.is_owned = false;
72225         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
72226         return ret_conv;
72227 }
72228
72229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72230         LDKUtxo this_ptr_conv;
72231         this_ptr_conv.inner = untag_ptr(this_ptr);
72232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72234         this_ptr_conv.is_owned = false;
72235         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
72236 }
72237
72238 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) {
72239         LDKOutPoint outpoint_arg_conv;
72240         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72241         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72242         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72243         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72244         void* output_arg_ptr = untag_ptr(output_arg);
72245         CHECK_ACCESS(output_arg_ptr);
72246         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
72247         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
72248         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
72249         int64_t ret_ref = 0;
72250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72252         return ret_ref;
72253 }
72254
72255 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
72256         LDKUtxo ret_var = Utxo_clone(arg);
72257         int64_t ret_ref = 0;
72258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72260         return ret_ref;
72261 }
72262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72263         LDKUtxo arg_conv;
72264         arg_conv.inner = untag_ptr(arg);
72265         arg_conv.is_owned = ptr_is_owned(arg);
72266         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72267         arg_conv.is_owned = false;
72268         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
72269         return ret_conv;
72270 }
72271
72272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72273         LDKUtxo orig_conv;
72274         orig_conv.inner = untag_ptr(orig);
72275         orig_conv.is_owned = ptr_is_owned(orig);
72276         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72277         orig_conv.is_owned = false;
72278         LDKUtxo ret_var = Utxo_clone(&orig_conv);
72279         int64_t ret_ref = 0;
72280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72282         return ret_ref;
72283 }
72284
72285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
72286         LDKUtxo o_conv;
72287         o_conv.inner = untag_ptr(o);
72288         o_conv.is_owned = ptr_is_owned(o);
72289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72290         o_conv.is_owned = false;
72291         int64_t ret_conv = Utxo_hash(&o_conv);
72292         return ret_conv;
72293 }
72294
72295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72296         LDKUtxo a_conv;
72297         a_conv.inner = untag_ptr(a);
72298         a_conv.is_owned = ptr_is_owned(a);
72299         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72300         a_conv.is_owned = false;
72301         LDKUtxo b_conv;
72302         b_conv.inner = untag_ptr(b);
72303         b_conv.is_owned = ptr_is_owned(b);
72304         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72305         b_conv.is_owned = false;
72306         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
72307         return ret_conv;
72308 }
72309
72310 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) {
72311         LDKOutPoint outpoint_conv;
72312         outpoint_conv.inner = untag_ptr(outpoint);
72313         outpoint_conv.is_owned = ptr_is_owned(outpoint);
72314         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
72315         outpoint_conv = OutPoint_clone(&outpoint_conv);
72316         uint8_t pubkey_hash_arr[20];
72317         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
72318         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
72319         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
72320         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
72321         int64_t ret_ref = 0;
72322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72324         return ret_ref;
72325 }
72326
72327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72328         LDKCoinSelection this_obj_conv;
72329         this_obj_conv.inner = untag_ptr(this_obj);
72330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72332         CoinSelection_free(this_obj_conv);
72333 }
72334
72335 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
72336         LDKCoinSelection this_ptr_conv;
72337         this_ptr_conv.inner = untag_ptr(this_ptr);
72338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72340         this_ptr_conv.is_owned = false;
72341         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
72342         int64_tArray ret_arr = NULL;
72343         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72344         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72345         for (size_t g = 0; g < ret_var.datalen; g++) {
72346                 LDKUtxo ret_conv_6_var = ret_var.data[g];
72347                 int64_t ret_conv_6_ref = 0;
72348                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
72349                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
72350                 ret_arr_ptr[g] = ret_conv_6_ref;
72351         }
72352         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72353         FREE(ret_var.data);
72354         return ret_arr;
72355 }
72356
72357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
72358         LDKCoinSelection this_ptr_conv;
72359         this_ptr_conv.inner = untag_ptr(this_ptr);
72360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72362         this_ptr_conv.is_owned = false;
72363         LDKCVec_UtxoZ val_constr;
72364         val_constr.datalen = (*env)->GetArrayLength(env, val);
72365         if (val_constr.datalen > 0)
72366                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
72367         else
72368                 val_constr.data = NULL;
72369         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
72370         for (size_t g = 0; g < val_constr.datalen; g++) {
72371                 int64_t val_conv_6 = val_vals[g];
72372                 LDKUtxo val_conv_6_conv;
72373                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
72374                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
72375                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
72376                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
72377                 val_constr.data[g] = val_conv_6_conv;
72378         }
72379         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
72380         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
72381 }
72382
72383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
72384         LDKCoinSelection this_ptr_conv;
72385         this_ptr_conv.inner = untag_ptr(this_ptr);
72386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72388         this_ptr_conv.is_owned = false;
72389         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
72390         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
72391         int64_t ret_ref = tag_ptr(ret_copy, true);
72392         return ret_ref;
72393 }
72394
72395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72396         LDKCoinSelection this_ptr_conv;
72397         this_ptr_conv.inner = untag_ptr(this_ptr);
72398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72400         this_ptr_conv.is_owned = false;
72401         void* val_ptr = untag_ptr(val);
72402         CHECK_ACCESS(val_ptr);
72403         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
72404         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
72405         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
72406 }
72407
72408 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) {
72409         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
72410         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
72411         if (confirmed_utxos_arg_constr.datalen > 0)
72412                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
72413         else
72414                 confirmed_utxos_arg_constr.data = NULL;
72415         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
72416         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
72417                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
72418                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
72419                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
72420                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
72421                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
72422                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
72423                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
72424         }
72425         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
72426         void* change_output_arg_ptr = untag_ptr(change_output_arg);
72427         CHECK_ACCESS(change_output_arg_ptr);
72428         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
72429         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
72430         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
72431         int64_t ret_ref = 0;
72432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72434         return ret_ref;
72435 }
72436
72437 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
72438         LDKCoinSelection ret_var = CoinSelection_clone(arg);
72439         int64_t ret_ref = 0;
72440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72442         return ret_ref;
72443 }
72444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72445         LDKCoinSelection arg_conv;
72446         arg_conv.inner = untag_ptr(arg);
72447         arg_conv.is_owned = ptr_is_owned(arg);
72448         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72449         arg_conv.is_owned = false;
72450         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
72451         return ret_conv;
72452 }
72453
72454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72455         LDKCoinSelection orig_conv;
72456         orig_conv.inner = untag_ptr(orig);
72457         orig_conv.is_owned = ptr_is_owned(orig);
72458         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72459         orig_conv.is_owned = false;
72460         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
72461         int64_t ret_ref = 0;
72462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72464         return ret_ref;
72465 }
72466
72467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72468         if (!ptr_is_owned(this_ptr)) return;
72469         void* this_ptr_ptr = untag_ptr(this_ptr);
72470         CHECK_ACCESS(this_ptr_ptr);
72471         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
72472         FREE(untag_ptr(this_ptr));
72473         CoinSelectionSource_free(this_ptr_conv);
72474 }
72475
72476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72477         if (!ptr_is_owned(this_ptr)) return;
72478         void* this_ptr_ptr = untag_ptr(this_ptr);
72479         CHECK_ACCESS(this_ptr_ptr);
72480         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
72481         FREE(untag_ptr(this_ptr));
72482         WalletSource_free(this_ptr_conv);
72483 }
72484
72485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72486         LDKWallet this_obj_conv;
72487         this_obj_conv.inner = untag_ptr(this_obj);
72488         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72490         Wallet_free(this_obj_conv);
72491 }
72492
72493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
72494         void* source_ptr = untag_ptr(source);
72495         CHECK_ACCESS(source_ptr);
72496         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
72497         if (source_conv.free == LDKWalletSource_JCalls_free) {
72498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72499                 LDKWalletSource_JCalls_cloned(&source_conv);
72500         }
72501         void* logger_ptr = untag_ptr(logger);
72502         CHECK_ACCESS(logger_ptr);
72503         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72504         if (logger_conv.free == LDKLogger_JCalls_free) {
72505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72506                 LDKLogger_JCalls_cloned(&logger_conv);
72507         }
72508         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
72509         int64_t ret_ref = 0;
72510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72512         return ret_ref;
72513 }
72514
72515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
72516         LDKWallet this_arg_conv;
72517         this_arg_conv.inner = untag_ptr(this_arg);
72518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72520         this_arg_conv.is_owned = false;
72521         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
72522         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
72523         return tag_ptr(ret_ret, true);
72524 }
72525
72526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72527         LDKBumpTransactionEventHandler this_obj_conv;
72528         this_obj_conv.inner = untag_ptr(this_obj);
72529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72531         BumpTransactionEventHandler_free(this_obj_conv);
72532 }
72533
72534 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) {
72535         void* broadcaster_ptr = untag_ptr(broadcaster);
72536         CHECK_ACCESS(broadcaster_ptr);
72537         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
72538         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
72539                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72540                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
72541         }
72542         void* utxo_source_ptr = untag_ptr(utxo_source);
72543         CHECK_ACCESS(utxo_source_ptr);
72544         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
72545         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
72546                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72547                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
72548         }
72549         void* signer_provider_ptr = untag_ptr(signer_provider);
72550         CHECK_ACCESS(signer_provider_ptr);
72551         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
72552         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
72553                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72554                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
72555         }
72556         void* logger_ptr = untag_ptr(logger);
72557         CHECK_ACCESS(logger_ptr);
72558         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72559         if (logger_conv.free == LDKLogger_JCalls_free) {
72560                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72561                 LDKLogger_JCalls_cloned(&logger_conv);
72562         }
72563         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
72564         int64_t ret_ref = 0;
72565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72567         return ret_ref;
72568 }
72569
72570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
72571         LDKBumpTransactionEventHandler this_arg_conv;
72572         this_arg_conv.inner = untag_ptr(this_arg);
72573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72575         this_arg_conv.is_owned = false;
72576         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
72577         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
72578 }
72579
72580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72581         LDKFilesystemStore this_obj_conv;
72582         this_obj_conv.inner = untag_ptr(this_obj);
72583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72585         FilesystemStore_free(this_obj_conv);
72586 }
72587
72588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
72589         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
72590         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
72591         int64_t ret_ref = 0;
72592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72594         return ret_ref;
72595 }
72596
72597 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
72598         LDKFilesystemStore this_arg_conv;
72599         this_arg_conv.inner = untag_ptr(this_arg);
72600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72602         this_arg_conv.is_owned = false;
72603         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
72604         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
72605         Str_free(ret_str);
72606         return ret_conv;
72607 }
72608
72609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
72610         LDKFilesystemStore this_arg_conv;
72611         this_arg_conv.inner = untag_ptr(this_arg);
72612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72614         this_arg_conv.is_owned = false;
72615         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
72616         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
72617         return tag_ptr(ret_ret, true);
72618 }
72619
72620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72621         LDKBackgroundProcessor this_obj_conv;
72622         this_obj_conv.inner = untag_ptr(this_obj);
72623         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72625         BackgroundProcessor_free(this_obj_conv);
72626 }
72627
72628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72629         if (!ptr_is_owned(this_ptr)) return;
72630         void* this_ptr_ptr = untag_ptr(this_ptr);
72631         CHECK_ACCESS(this_ptr_ptr);
72632         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
72633         FREE(untag_ptr(this_ptr));
72634         GossipSync_free(this_ptr_conv);
72635 }
72636
72637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
72638         LDKP2PGossipSync a_conv;
72639         a_conv.inner = untag_ptr(a);
72640         a_conv.is_owned = ptr_is_owned(a);
72641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72642         a_conv.is_owned = false;
72643         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
72644         *ret_copy = GossipSync_p2_p(&a_conv);
72645         int64_t ret_ref = tag_ptr(ret_copy, true);
72646         return ret_ref;
72647 }
72648
72649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
72650         LDKRapidGossipSync a_conv;
72651         a_conv.inner = untag_ptr(a);
72652         a_conv.is_owned = ptr_is_owned(a);
72653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72654         a_conv.is_owned = false;
72655         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
72656         *ret_copy = GossipSync_rapid(&a_conv);
72657         int64_t ret_ref = tag_ptr(ret_copy, true);
72658         return ret_ref;
72659 }
72660
72661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
72662         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
72663         *ret_copy = GossipSync_none();
72664         int64_t ret_ref = tag_ptr(ret_copy, true);
72665         return ret_ref;
72666 }
72667
72668 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) {
72669         void* persister_ptr = untag_ptr(persister);
72670         CHECK_ACCESS(persister_ptr);
72671         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
72672         if (persister_conv.free == LDKPersister_JCalls_free) {
72673                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72674                 LDKPersister_JCalls_cloned(&persister_conv);
72675         }
72676         void* event_handler_ptr = untag_ptr(event_handler);
72677         CHECK_ACCESS(event_handler_ptr);
72678         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
72679         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
72680                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72681                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
72682         }
72683         LDKChainMonitor chain_monitor_conv;
72684         chain_monitor_conv.inner = untag_ptr(chain_monitor);
72685         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
72686         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
72687         chain_monitor_conv.is_owned = false;
72688         LDKChannelManager channel_manager_conv;
72689         channel_manager_conv.inner = untag_ptr(channel_manager);
72690         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
72691         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
72692         channel_manager_conv.is_owned = false;
72693         void* gossip_sync_ptr = untag_ptr(gossip_sync);
72694         CHECK_ACCESS(gossip_sync_ptr);
72695         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
72696         // WARNING: we may need a move here but no clone is available for LDKGossipSync
72697         LDKPeerManager peer_manager_conv;
72698         peer_manager_conv.inner = untag_ptr(peer_manager);
72699         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
72700         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
72701         peer_manager_conv.is_owned = false;
72702         void* logger_ptr = untag_ptr(logger);
72703         CHECK_ACCESS(logger_ptr);
72704         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72705         if (logger_conv.free == LDKLogger_JCalls_free) {
72706                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72707                 LDKLogger_JCalls_cloned(&logger_conv);
72708         }
72709         void* scorer_ptr = untag_ptr(scorer);
72710         CHECK_ACCESS(scorer_ptr);
72711         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
72712         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
72713         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
72714                 // Manually implement clone for Java trait instances
72715                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
72716                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72717                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
72718                 }
72719         }
72720         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);
72721         int64_t ret_ref = 0;
72722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72724         return ret_ref;
72725 }
72726
72727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
72728         LDKBackgroundProcessor 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         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
72733         
72734         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
72735         *ret_conv = BackgroundProcessor_join(this_arg_conv);
72736         return tag_ptr(ret_conv, true);
72737 }
72738
72739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
72740         LDKBackgroundProcessor this_arg_conv;
72741         this_arg_conv.inner = untag_ptr(this_arg);
72742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72744         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
72745         
72746         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
72747         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
72748         return tag_ptr(ret_conv, true);
72749 }
72750
72751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72752         if (!ptr_is_owned(this_ptr)) return;
72753         void* this_ptr_ptr = untag_ptr(this_ptr);
72754         CHECK_ACCESS(this_ptr_ptr);
72755         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
72756         FREE(untag_ptr(this_ptr));
72757         Bolt11ParseError_free(this_ptr_conv);
72758 }
72759
72760 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
72761         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72762         *ret_copy = Bolt11ParseError_clone(arg);
72763         int64_t ret_ref = tag_ptr(ret_copy, true);
72764         return ret_ref;
72765 }
72766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72767         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
72768         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
72769         return ret_conv;
72770 }
72771
72772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72773         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
72774         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72775         *ret_copy = Bolt11ParseError_clone(orig_conv);
72776         int64_t ret_ref = tag_ptr(ret_copy, true);
72777         return ret_ref;
72778 }
72779
72780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
72781         void* a_ptr = untag_ptr(a);
72782         CHECK_ACCESS(a_ptr);
72783         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
72784         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
72785         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72786         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
72787         int64_t ret_ref = tag_ptr(ret_copy, true);
72788         return ret_ref;
72789 }
72790
72791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
72792         
72793         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72794         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
72795         int64_t ret_ref = tag_ptr(ret_copy, true);
72796         return ret_ref;
72797 }
72798
72799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
72800         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
72801         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72802         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
72803         int64_t ret_ref = tag_ptr(ret_copy, true);
72804         return ret_ref;
72805 }
72806
72807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
72808         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72809         *ret_copy = Bolt11ParseError_bad_prefix();
72810         int64_t ret_ref = tag_ptr(ret_copy, true);
72811         return ret_ref;
72812 }
72813
72814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
72815         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72816         *ret_copy = Bolt11ParseError_unknown_currency();
72817         int64_t ret_ref = tag_ptr(ret_copy, true);
72818         return ret_ref;
72819 }
72820
72821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
72822         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72823         *ret_copy = Bolt11ParseError_unknown_si_prefix();
72824         int64_t ret_ref = tag_ptr(ret_copy, true);
72825         return ret_ref;
72826 }
72827
72828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
72829         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72830         *ret_copy = Bolt11ParseError_malformed_hrp();
72831         int64_t ret_ref = tag_ptr(ret_copy, true);
72832         return ret_ref;
72833 }
72834
72835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
72836         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72837         *ret_copy = Bolt11ParseError_too_short_data_part();
72838         int64_t ret_ref = tag_ptr(ret_copy, true);
72839         return ret_ref;
72840 }
72841
72842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
72843         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72844         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
72845         int64_t ret_ref = tag_ptr(ret_copy, true);
72846         return ret_ref;
72847 }
72848
72849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
72850         
72851         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72852         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
72853         int64_t ret_ref = tag_ptr(ret_copy, true);
72854         return ret_ref;
72855 }
72856
72857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
72858         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72859         *ret_copy = Bolt11ParseError_padding_error();
72860         int64_t ret_ref = tag_ptr(ret_copy, true);
72861         return ret_ref;
72862 }
72863
72864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
72865         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72866         *ret_copy = Bolt11ParseError_integer_overflow_error();
72867         int64_t ret_ref = tag_ptr(ret_copy, true);
72868         return ret_ref;
72869 }
72870
72871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
72872         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72873         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
72874         int64_t ret_ref = tag_ptr(ret_copy, true);
72875         return ret_ref;
72876 }
72877
72878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
72879         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72880         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
72881         int64_t ret_ref = tag_ptr(ret_copy, true);
72882         return ret_ref;
72883 }
72884
72885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
72886         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72887         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
72888         int64_t ret_ref = tag_ptr(ret_copy, true);
72889         return ret_ref;
72890 }
72891
72892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
72893         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72894         *ret_copy = Bolt11ParseError_invalid_recovery_id();
72895         int64_t ret_ref = tag_ptr(ret_copy, true);
72896         return ret_ref;
72897 }
72898
72899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
72900         LDKStr a_conv = java_to_owned_str(env, a);
72901         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72902         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
72903         int64_t ret_ref = tag_ptr(ret_copy, true);
72904         return ret_ref;
72905 }
72906
72907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
72908         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72909         *ret_copy = Bolt11ParseError_skip();
72910         int64_t ret_ref = tag_ptr(ret_copy, true);
72911         return ret_ref;
72912 }
72913
72914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72915         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
72916         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
72917         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
72918         return ret_conv;
72919 }
72920
72921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72922         if (!ptr_is_owned(this_ptr)) return;
72923         void* this_ptr_ptr = untag_ptr(this_ptr);
72924         CHECK_ACCESS(this_ptr_ptr);
72925         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
72926         FREE(untag_ptr(this_ptr));
72927         ParseOrSemanticError_free(this_ptr_conv);
72928 }
72929
72930 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
72931         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72932         *ret_copy = ParseOrSemanticError_clone(arg);
72933         int64_t ret_ref = tag_ptr(ret_copy, true);
72934         return ret_ref;
72935 }
72936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72937         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
72938         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
72939         return ret_conv;
72940 }
72941
72942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72943         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
72944         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72945         *ret_copy = ParseOrSemanticError_clone(orig_conv);
72946         int64_t ret_ref = tag_ptr(ret_copy, true);
72947         return ret_ref;
72948 }
72949
72950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
72951         void* a_ptr = untag_ptr(a);
72952         CHECK_ACCESS(a_ptr);
72953         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
72954         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
72955         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72956         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
72957         int64_t ret_ref = tag_ptr(ret_copy, true);
72958         return ret_ref;
72959 }
72960
72961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
72962         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
72963         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72964         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
72965         int64_t ret_ref = tag_ptr(ret_copy, true);
72966         return ret_ref;
72967 }
72968
72969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72970         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
72971         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
72972         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
72973         return ret_conv;
72974 }
72975
72976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72977         LDKBolt11Invoice this_obj_conv;
72978         this_obj_conv.inner = untag_ptr(this_obj);
72979         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72981         Bolt11Invoice_free(this_obj_conv);
72982 }
72983
72984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72985         LDKBolt11Invoice a_conv;
72986         a_conv.inner = untag_ptr(a);
72987         a_conv.is_owned = ptr_is_owned(a);
72988         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72989         a_conv.is_owned = false;
72990         LDKBolt11Invoice b_conv;
72991         b_conv.inner = untag_ptr(b);
72992         b_conv.is_owned = ptr_is_owned(b);
72993         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72994         b_conv.is_owned = false;
72995         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
72996         return ret_conv;
72997 }
72998
72999 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
73000         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
73001         int64_t ret_ref = 0;
73002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73004         return ret_ref;
73005 }
73006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73007         LDKBolt11Invoice arg_conv;
73008         arg_conv.inner = untag_ptr(arg);
73009         arg_conv.is_owned = ptr_is_owned(arg);
73010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73011         arg_conv.is_owned = false;
73012         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
73013         return ret_conv;
73014 }
73015
73016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73017         LDKBolt11Invoice orig_conv;
73018         orig_conv.inner = untag_ptr(orig);
73019         orig_conv.is_owned = ptr_is_owned(orig);
73020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73021         orig_conv.is_owned = false;
73022         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
73023         int64_t ret_ref = 0;
73024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73026         return ret_ref;
73027 }
73028
73029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73030         LDKBolt11Invoice o_conv;
73031         o_conv.inner = untag_ptr(o);
73032         o_conv.is_owned = ptr_is_owned(o);
73033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73034         o_conv.is_owned = false;
73035         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
73036         return ret_conv;
73037 }
73038
73039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73040         LDKSignedRawBolt11Invoice this_obj_conv;
73041         this_obj_conv.inner = untag_ptr(this_obj);
73042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73044         SignedRawBolt11Invoice_free(this_obj_conv);
73045 }
73046
73047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73048         LDKSignedRawBolt11Invoice a_conv;
73049         a_conv.inner = untag_ptr(a);
73050         a_conv.is_owned = ptr_is_owned(a);
73051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73052         a_conv.is_owned = false;
73053         LDKSignedRawBolt11Invoice b_conv;
73054         b_conv.inner = untag_ptr(b);
73055         b_conv.is_owned = ptr_is_owned(b);
73056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73057         b_conv.is_owned = false;
73058         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
73059         return ret_conv;
73060 }
73061
73062 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
73063         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
73064         int64_t ret_ref = 0;
73065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73067         return ret_ref;
73068 }
73069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73070         LDKSignedRawBolt11Invoice arg_conv;
73071         arg_conv.inner = untag_ptr(arg);
73072         arg_conv.is_owned = ptr_is_owned(arg);
73073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73074         arg_conv.is_owned = false;
73075         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
73076         return ret_conv;
73077 }
73078
73079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73080         LDKSignedRawBolt11Invoice orig_conv;
73081         orig_conv.inner = untag_ptr(orig);
73082         orig_conv.is_owned = ptr_is_owned(orig);
73083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73084         orig_conv.is_owned = false;
73085         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
73086         int64_t ret_ref = 0;
73087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73089         return ret_ref;
73090 }
73091
73092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73093         LDKSignedRawBolt11Invoice o_conv;
73094         o_conv.inner = untag_ptr(o);
73095         o_conv.is_owned = ptr_is_owned(o);
73096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73097         o_conv.is_owned = false;
73098         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
73099         return ret_conv;
73100 }
73101
73102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73103         LDKRawBolt11Invoice this_obj_conv;
73104         this_obj_conv.inner = untag_ptr(this_obj);
73105         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73107         RawBolt11Invoice_free(this_obj_conv);
73108 }
73109
73110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
73111         LDKRawBolt11Invoice this_ptr_conv;
73112         this_ptr_conv.inner = untag_ptr(this_ptr);
73113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73115         this_ptr_conv.is_owned = false;
73116         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
73117         int64_t ret_ref = 0;
73118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73120         return ret_ref;
73121 }
73122
73123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73124         LDKRawBolt11Invoice this_ptr_conv;
73125         this_ptr_conv.inner = untag_ptr(this_ptr);
73126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73128         this_ptr_conv.is_owned = false;
73129         LDKRawDataPart val_conv;
73130         val_conv.inner = untag_ptr(val);
73131         val_conv.is_owned = ptr_is_owned(val);
73132         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73133         val_conv = RawDataPart_clone(&val_conv);
73134         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
73135 }
73136
73137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73138         LDKRawBolt11Invoice a_conv;
73139         a_conv.inner = untag_ptr(a);
73140         a_conv.is_owned = ptr_is_owned(a);
73141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73142         a_conv.is_owned = false;
73143         LDKRawBolt11Invoice b_conv;
73144         b_conv.inner = untag_ptr(b);
73145         b_conv.is_owned = ptr_is_owned(b);
73146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73147         b_conv.is_owned = false;
73148         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
73149         return ret_conv;
73150 }
73151
73152 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
73153         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
73154         int64_t ret_ref = 0;
73155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73157         return ret_ref;
73158 }
73159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73160         LDKRawBolt11Invoice arg_conv;
73161         arg_conv.inner = untag_ptr(arg);
73162         arg_conv.is_owned = ptr_is_owned(arg);
73163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73164         arg_conv.is_owned = false;
73165         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
73166         return ret_conv;
73167 }
73168
73169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73170         LDKRawBolt11Invoice orig_conv;
73171         orig_conv.inner = untag_ptr(orig);
73172         orig_conv.is_owned = ptr_is_owned(orig);
73173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73174         orig_conv.is_owned = false;
73175         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
73176         int64_t ret_ref = 0;
73177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73179         return ret_ref;
73180 }
73181
73182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73183         LDKRawBolt11Invoice o_conv;
73184         o_conv.inner = untag_ptr(o);
73185         o_conv.is_owned = ptr_is_owned(o);
73186         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73187         o_conv.is_owned = false;
73188         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
73189         return ret_conv;
73190 }
73191
73192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73193         LDKRawDataPart this_obj_conv;
73194         this_obj_conv.inner = untag_ptr(this_obj);
73195         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73197         RawDataPart_free(this_obj_conv);
73198 }
73199
73200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
73201         LDKRawDataPart this_ptr_conv;
73202         this_ptr_conv.inner = untag_ptr(this_ptr);
73203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73205         this_ptr_conv.is_owned = false;
73206         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
73207         int64_t ret_ref = 0;
73208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73210         return ret_ref;
73211 }
73212
73213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73214         LDKRawDataPart this_ptr_conv;
73215         this_ptr_conv.inner = untag_ptr(this_ptr);
73216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73218         this_ptr_conv.is_owned = false;
73219         LDKPositiveTimestamp val_conv;
73220         val_conv.inner = untag_ptr(val);
73221         val_conv.is_owned = ptr_is_owned(val);
73222         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73223         val_conv = PositiveTimestamp_clone(&val_conv);
73224         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
73225 }
73226
73227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73228         LDKRawDataPart a_conv;
73229         a_conv.inner = untag_ptr(a);
73230         a_conv.is_owned = ptr_is_owned(a);
73231         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73232         a_conv.is_owned = false;
73233         LDKRawDataPart b_conv;
73234         b_conv.inner = untag_ptr(b);
73235         b_conv.is_owned = ptr_is_owned(b);
73236         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73237         b_conv.is_owned = false;
73238         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
73239         return ret_conv;
73240 }
73241
73242 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
73243         LDKRawDataPart ret_var = RawDataPart_clone(arg);
73244         int64_t ret_ref = 0;
73245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73247         return ret_ref;
73248 }
73249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73250         LDKRawDataPart arg_conv;
73251         arg_conv.inner = untag_ptr(arg);
73252         arg_conv.is_owned = ptr_is_owned(arg);
73253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73254         arg_conv.is_owned = false;
73255         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
73256         return ret_conv;
73257 }
73258
73259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73260         LDKRawDataPart orig_conv;
73261         orig_conv.inner = untag_ptr(orig);
73262         orig_conv.is_owned = ptr_is_owned(orig);
73263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73264         orig_conv.is_owned = false;
73265         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
73266         int64_t ret_ref = 0;
73267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73269         return ret_ref;
73270 }
73271
73272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
73273         LDKRawDataPart o_conv;
73274         o_conv.inner = untag_ptr(o);
73275         o_conv.is_owned = ptr_is_owned(o);
73276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73277         o_conv.is_owned = false;
73278         int64_t ret_conv = RawDataPart_hash(&o_conv);
73279         return ret_conv;
73280 }
73281
73282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73283         LDKPositiveTimestamp this_obj_conv;
73284         this_obj_conv.inner = untag_ptr(this_obj);
73285         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73287         PositiveTimestamp_free(this_obj_conv);
73288 }
73289
73290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73291         LDKPositiveTimestamp a_conv;
73292         a_conv.inner = untag_ptr(a);
73293         a_conv.is_owned = ptr_is_owned(a);
73294         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73295         a_conv.is_owned = false;
73296         LDKPositiveTimestamp b_conv;
73297         b_conv.inner = untag_ptr(b);
73298         b_conv.is_owned = ptr_is_owned(b);
73299         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73300         b_conv.is_owned = false;
73301         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
73302         return ret_conv;
73303 }
73304
73305 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
73306         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
73307         int64_t ret_ref = 0;
73308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73310         return ret_ref;
73311 }
73312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73313         LDKPositiveTimestamp arg_conv;
73314         arg_conv.inner = untag_ptr(arg);
73315         arg_conv.is_owned = ptr_is_owned(arg);
73316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73317         arg_conv.is_owned = false;
73318         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
73319         return ret_conv;
73320 }
73321
73322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73323         LDKPositiveTimestamp orig_conv;
73324         orig_conv.inner = untag_ptr(orig);
73325         orig_conv.is_owned = ptr_is_owned(orig);
73326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73327         orig_conv.is_owned = false;
73328         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
73329         int64_t ret_ref = 0;
73330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73332         return ret_ref;
73333 }
73334
73335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
73336         LDKPositiveTimestamp o_conv;
73337         o_conv.inner = untag_ptr(o);
73338         o_conv.is_owned = ptr_is_owned(o);
73339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73340         o_conv.is_owned = false;
73341         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
73342         return ret_conv;
73343 }
73344
73345 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73346         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
73347         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
73348         return ret_conv;
73349 }
73350
73351 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
73352         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
73353         return ret_conv;
73354 }
73355
73356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
73357         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
73358         return ret_conv;
73359 }
73360
73361 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
73362         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
73363         return ret_conv;
73364 }
73365
73366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
73367         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
73368         return ret_conv;
73369 }
73370
73371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73372         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
73373         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
73374         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
73375         return ret_conv;
73376 }
73377
73378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
73379         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
73380         int64_t ret_conv = SiPrefix_hash(o_conv);
73381         return ret_conv;
73382 }
73383
73384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
73385         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
73386         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
73387         return ret_conv;
73388 }
73389
73390 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73391         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
73392         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
73393         return ret_conv;
73394 }
73395
73396 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
73397         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
73398         return ret_conv;
73399 }
73400
73401 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
73402         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
73403         return ret_conv;
73404 }
73405
73406 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
73407         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
73408         return ret_conv;
73409 }
73410
73411 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
73412         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
73413         return ret_conv;
73414 }
73415
73416 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
73417         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
73418         return ret_conv;
73419 }
73420
73421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
73422         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
73423         int64_t ret_conv = Currency_hash(o_conv);
73424         return ret_conv;
73425 }
73426
73427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73428         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
73429         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
73430         jboolean ret_conv = Currency_eq(a_conv, b_conv);
73431         return ret_conv;
73432 }
73433
73434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73435         LDKSha256 this_obj_conv;
73436         this_obj_conv.inner = untag_ptr(this_obj);
73437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73439         Sha256_free(this_obj_conv);
73440 }
73441
73442 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
73443         LDKSha256 ret_var = Sha256_clone(arg);
73444         int64_t ret_ref = 0;
73445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73447         return ret_ref;
73448 }
73449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73450         LDKSha256 arg_conv;
73451         arg_conv.inner = untag_ptr(arg);
73452         arg_conv.is_owned = ptr_is_owned(arg);
73453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73454         arg_conv.is_owned = false;
73455         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
73456         return ret_conv;
73457 }
73458
73459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73460         LDKSha256 orig_conv;
73461         orig_conv.inner = untag_ptr(orig);
73462         orig_conv.is_owned = ptr_is_owned(orig);
73463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73464         orig_conv.is_owned = false;
73465         LDKSha256 ret_var = Sha256_clone(&orig_conv);
73466         int64_t ret_ref = 0;
73467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73469         return ret_ref;
73470 }
73471
73472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
73473         LDKSha256 o_conv;
73474         o_conv.inner = untag_ptr(o);
73475         o_conv.is_owned = ptr_is_owned(o);
73476         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73477         o_conv.is_owned = false;
73478         int64_t ret_conv = Sha256_hash(&o_conv);
73479         return ret_conv;
73480 }
73481
73482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73483         LDKSha256 a_conv;
73484         a_conv.inner = untag_ptr(a);
73485         a_conv.is_owned = ptr_is_owned(a);
73486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73487         a_conv.is_owned = false;
73488         LDKSha256 b_conv;
73489         b_conv.inner = untag_ptr(b);
73490         b_conv.is_owned = ptr_is_owned(b);
73491         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73492         b_conv.is_owned = false;
73493         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
73494         return ret_conv;
73495 }
73496
73497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
73498         uint8_t bytes_arr[32];
73499         CHECK((*env)->GetArrayLength(env, bytes) == 32);
73500         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
73501         uint8_t (*bytes_ref)[32] = &bytes_arr;
73502         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
73503         int64_t ret_ref = 0;
73504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73506         return ret_ref;
73507 }
73508
73509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73510         LDKDescription this_obj_conv;
73511         this_obj_conv.inner = untag_ptr(this_obj);
73512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73514         Description_free(this_obj_conv);
73515 }
73516
73517 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
73518         LDKDescription ret_var = Description_clone(arg);
73519         int64_t ret_ref = 0;
73520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73522         return ret_ref;
73523 }
73524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73525         LDKDescription arg_conv;
73526         arg_conv.inner = untag_ptr(arg);
73527         arg_conv.is_owned = ptr_is_owned(arg);
73528         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73529         arg_conv.is_owned = false;
73530         int64_t ret_conv = Description_clone_ptr(&arg_conv);
73531         return ret_conv;
73532 }
73533
73534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73535         LDKDescription orig_conv;
73536         orig_conv.inner = untag_ptr(orig);
73537         orig_conv.is_owned = ptr_is_owned(orig);
73538         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73539         orig_conv.is_owned = false;
73540         LDKDescription ret_var = Description_clone(&orig_conv);
73541         int64_t ret_ref = 0;
73542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73544         return ret_ref;
73545 }
73546
73547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
73548         LDKDescription o_conv;
73549         o_conv.inner = untag_ptr(o);
73550         o_conv.is_owned = ptr_is_owned(o);
73551         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73552         o_conv.is_owned = false;
73553         int64_t ret_conv = Description_hash(&o_conv);
73554         return ret_conv;
73555 }
73556
73557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73558         LDKDescription a_conv;
73559         a_conv.inner = untag_ptr(a);
73560         a_conv.is_owned = ptr_is_owned(a);
73561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73562         a_conv.is_owned = false;
73563         LDKDescription b_conv;
73564         b_conv.inner = untag_ptr(b);
73565         b_conv.is_owned = ptr_is_owned(b);
73566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73567         b_conv.is_owned = false;
73568         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
73569         return ret_conv;
73570 }
73571
73572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73573         LDKPayeePubKey this_obj_conv;
73574         this_obj_conv.inner = untag_ptr(this_obj);
73575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73577         PayeePubKey_free(this_obj_conv);
73578 }
73579
73580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
73581         LDKPayeePubKey this_ptr_conv;
73582         this_ptr_conv.inner = untag_ptr(this_ptr);
73583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73585         this_ptr_conv.is_owned = false;
73586         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73587         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
73588         return ret_arr;
73589 }
73590
73591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73592         LDKPayeePubKey this_ptr_conv;
73593         this_ptr_conv.inner = untag_ptr(this_ptr);
73594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73596         this_ptr_conv.is_owned = false;
73597         LDKPublicKey val_ref;
73598         CHECK((*env)->GetArrayLength(env, val) == 33);
73599         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
73600         PayeePubKey_set_a(&this_ptr_conv, val_ref);
73601 }
73602
73603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
73604         LDKPublicKey a_arg_ref;
73605         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
73606         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
73607         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
73608         int64_t ret_ref = 0;
73609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73611         return ret_ref;
73612 }
73613
73614 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
73615         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
73616         int64_t ret_ref = 0;
73617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73619         return ret_ref;
73620 }
73621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73622         LDKPayeePubKey arg_conv;
73623         arg_conv.inner = untag_ptr(arg);
73624         arg_conv.is_owned = ptr_is_owned(arg);
73625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73626         arg_conv.is_owned = false;
73627         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
73628         return ret_conv;
73629 }
73630
73631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73632         LDKPayeePubKey orig_conv;
73633         orig_conv.inner = untag_ptr(orig);
73634         orig_conv.is_owned = ptr_is_owned(orig);
73635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73636         orig_conv.is_owned = false;
73637         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
73638         int64_t ret_ref = 0;
73639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73641         return ret_ref;
73642 }
73643
73644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
73645         LDKPayeePubKey o_conv;
73646         o_conv.inner = untag_ptr(o);
73647         o_conv.is_owned = ptr_is_owned(o);
73648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73649         o_conv.is_owned = false;
73650         int64_t ret_conv = PayeePubKey_hash(&o_conv);
73651         return ret_conv;
73652 }
73653
73654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73655         LDKPayeePubKey a_conv;
73656         a_conv.inner = untag_ptr(a);
73657         a_conv.is_owned = ptr_is_owned(a);
73658         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73659         a_conv.is_owned = false;
73660         LDKPayeePubKey b_conv;
73661         b_conv.inner = untag_ptr(b);
73662         b_conv.is_owned = ptr_is_owned(b);
73663         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73664         b_conv.is_owned = false;
73665         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
73666         return ret_conv;
73667 }
73668
73669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73670         LDKExpiryTime this_obj_conv;
73671         this_obj_conv.inner = untag_ptr(this_obj);
73672         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73674         ExpiryTime_free(this_obj_conv);
73675 }
73676
73677 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
73678         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
73679         int64_t ret_ref = 0;
73680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73682         return ret_ref;
73683 }
73684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73685         LDKExpiryTime arg_conv;
73686         arg_conv.inner = untag_ptr(arg);
73687         arg_conv.is_owned = ptr_is_owned(arg);
73688         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73689         arg_conv.is_owned = false;
73690         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
73691         return ret_conv;
73692 }
73693
73694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73695         LDKExpiryTime orig_conv;
73696         orig_conv.inner = untag_ptr(orig);
73697         orig_conv.is_owned = ptr_is_owned(orig);
73698         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73699         orig_conv.is_owned = false;
73700         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
73701         int64_t ret_ref = 0;
73702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73704         return ret_ref;
73705 }
73706
73707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
73708         LDKExpiryTime o_conv;
73709         o_conv.inner = untag_ptr(o);
73710         o_conv.is_owned = ptr_is_owned(o);
73711         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73712         o_conv.is_owned = false;
73713         int64_t ret_conv = ExpiryTime_hash(&o_conv);
73714         return ret_conv;
73715 }
73716
73717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73718         LDKExpiryTime a_conv;
73719         a_conv.inner = untag_ptr(a);
73720         a_conv.is_owned = ptr_is_owned(a);
73721         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73722         a_conv.is_owned = false;
73723         LDKExpiryTime b_conv;
73724         b_conv.inner = untag_ptr(b);
73725         b_conv.is_owned = ptr_is_owned(b);
73726         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73727         b_conv.is_owned = false;
73728         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
73729         return ret_conv;
73730 }
73731
73732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73733         LDKMinFinalCltvExpiryDelta this_obj_conv;
73734         this_obj_conv.inner = untag_ptr(this_obj);
73735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73737         MinFinalCltvExpiryDelta_free(this_obj_conv);
73738 }
73739
73740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
73741         LDKMinFinalCltvExpiryDelta this_ptr_conv;
73742         this_ptr_conv.inner = untag_ptr(this_ptr);
73743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73745         this_ptr_conv.is_owned = false;
73746         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
73747         return ret_conv;
73748 }
73749
73750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73751         LDKMinFinalCltvExpiryDelta this_ptr_conv;
73752         this_ptr_conv.inner = untag_ptr(this_ptr);
73753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73755         this_ptr_conv.is_owned = false;
73756         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
73757 }
73758
73759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
73760         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
73761         int64_t ret_ref = 0;
73762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73764         return ret_ref;
73765 }
73766
73767 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
73768         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
73769         int64_t ret_ref = 0;
73770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73772         return ret_ref;
73773 }
73774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73775         LDKMinFinalCltvExpiryDelta arg_conv;
73776         arg_conv.inner = untag_ptr(arg);
73777         arg_conv.is_owned = ptr_is_owned(arg);
73778         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73779         arg_conv.is_owned = false;
73780         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
73781         return ret_conv;
73782 }
73783
73784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73785         LDKMinFinalCltvExpiryDelta orig_conv;
73786         orig_conv.inner = untag_ptr(orig);
73787         orig_conv.is_owned = ptr_is_owned(orig);
73788         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73789         orig_conv.is_owned = false;
73790         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
73791         int64_t ret_ref = 0;
73792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73794         return ret_ref;
73795 }
73796
73797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
73798         LDKMinFinalCltvExpiryDelta o_conv;
73799         o_conv.inner = untag_ptr(o);
73800         o_conv.is_owned = ptr_is_owned(o);
73801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73802         o_conv.is_owned = false;
73803         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
73804         return ret_conv;
73805 }
73806
73807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73808         LDKMinFinalCltvExpiryDelta a_conv;
73809         a_conv.inner = untag_ptr(a);
73810         a_conv.is_owned = ptr_is_owned(a);
73811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73812         a_conv.is_owned = false;
73813         LDKMinFinalCltvExpiryDelta b_conv;
73814         b_conv.inner = untag_ptr(b);
73815         b_conv.is_owned = ptr_is_owned(b);
73816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73817         b_conv.is_owned = false;
73818         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
73819         return ret_conv;
73820 }
73821
73822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73823         if (!ptr_is_owned(this_ptr)) return;
73824         void* this_ptr_ptr = untag_ptr(this_ptr);
73825         CHECK_ACCESS(this_ptr_ptr);
73826         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
73827         FREE(untag_ptr(this_ptr));
73828         Fallback_free(this_ptr_conv);
73829 }
73830
73831 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
73832         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73833         *ret_copy = Fallback_clone(arg);
73834         int64_t ret_ref = tag_ptr(ret_copy, true);
73835         return ret_ref;
73836 }
73837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73838         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
73839         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
73840         return ret_conv;
73841 }
73842
73843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73844         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
73845         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73846         *ret_copy = Fallback_clone(orig_conv);
73847         int64_t ret_ref = tag_ptr(ret_copy, true);
73848         return ret_ref;
73849 }
73850
73851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
73852         
73853         LDKCVec_u8Z program_ref;
73854         program_ref.datalen = (*env)->GetArrayLength(env, program);
73855         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
73856         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
73857         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73858         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
73859         int64_t ret_ref = tag_ptr(ret_copy, true);
73860         return ret_ref;
73861 }
73862
73863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
73864         LDKTwentyBytes a_ref;
73865         CHECK((*env)->GetArrayLength(env, a) == 20);
73866         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
73867         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73868         *ret_copy = Fallback_pub_key_hash(a_ref);
73869         int64_t ret_ref = tag_ptr(ret_copy, true);
73870         return ret_ref;
73871 }
73872
73873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
73874         LDKTwentyBytes a_ref;
73875         CHECK((*env)->GetArrayLength(env, a) == 20);
73876         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
73877         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73878         *ret_copy = Fallback_script_hash(a_ref);
73879         int64_t ret_ref = tag_ptr(ret_copy, true);
73880         return ret_ref;
73881 }
73882
73883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
73884         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
73885         int64_t ret_conv = Fallback_hash(o_conv);
73886         return ret_conv;
73887 }
73888
73889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73890         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
73891         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
73892         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
73893         return ret_conv;
73894 }
73895
73896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73897         LDKBolt11InvoiceSignature this_obj_conv;
73898         this_obj_conv.inner = untag_ptr(this_obj);
73899         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73901         Bolt11InvoiceSignature_free(this_obj_conv);
73902 }
73903
73904 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
73905         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
73906         int64_t ret_ref = 0;
73907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73909         return ret_ref;
73910 }
73911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73912         LDKBolt11InvoiceSignature arg_conv;
73913         arg_conv.inner = untag_ptr(arg);
73914         arg_conv.is_owned = ptr_is_owned(arg);
73915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73916         arg_conv.is_owned = false;
73917         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
73918         return ret_conv;
73919 }
73920
73921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73922         LDKBolt11InvoiceSignature orig_conv;
73923         orig_conv.inner = untag_ptr(orig);
73924         orig_conv.is_owned = ptr_is_owned(orig);
73925         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73926         orig_conv.is_owned = false;
73927         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
73928         int64_t ret_ref = 0;
73929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73931         return ret_ref;
73932 }
73933
73934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
73935         LDKBolt11InvoiceSignature o_conv;
73936         o_conv.inner = untag_ptr(o);
73937         o_conv.is_owned = ptr_is_owned(o);
73938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73939         o_conv.is_owned = false;
73940         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
73941         return ret_conv;
73942 }
73943
73944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73945         LDKBolt11InvoiceSignature a_conv;
73946         a_conv.inner = untag_ptr(a);
73947         a_conv.is_owned = ptr_is_owned(a);
73948         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73949         a_conv.is_owned = false;
73950         LDKBolt11InvoiceSignature b_conv;
73951         b_conv.inner = untag_ptr(b);
73952         b_conv.is_owned = ptr_is_owned(b);
73953         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73954         b_conv.is_owned = false;
73955         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
73956         return ret_conv;
73957 }
73958
73959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73960         LDKPrivateRoute this_obj_conv;
73961         this_obj_conv.inner = untag_ptr(this_obj);
73962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73964         PrivateRoute_free(this_obj_conv);
73965 }
73966
73967 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
73968         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
73969         int64_t ret_ref = 0;
73970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73972         return ret_ref;
73973 }
73974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73975         LDKPrivateRoute arg_conv;
73976         arg_conv.inner = untag_ptr(arg);
73977         arg_conv.is_owned = ptr_is_owned(arg);
73978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73979         arg_conv.is_owned = false;
73980         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
73981         return ret_conv;
73982 }
73983
73984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73985         LDKPrivateRoute orig_conv;
73986         orig_conv.inner = untag_ptr(orig);
73987         orig_conv.is_owned = ptr_is_owned(orig);
73988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73989         orig_conv.is_owned = false;
73990         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
73991         int64_t ret_ref = 0;
73992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73994         return ret_ref;
73995 }
73996
73997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
73998         LDKPrivateRoute o_conv;
73999         o_conv.inner = untag_ptr(o);
74000         o_conv.is_owned = ptr_is_owned(o);
74001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74002         o_conv.is_owned = false;
74003         int64_t ret_conv = PrivateRoute_hash(&o_conv);
74004         return ret_conv;
74005 }
74006
74007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74008         LDKPrivateRoute a_conv;
74009         a_conv.inner = untag_ptr(a);
74010         a_conv.is_owned = ptr_is_owned(a);
74011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74012         a_conv.is_owned = false;
74013         LDKPrivateRoute b_conv;
74014         b_conv.inner = untag_ptr(b);
74015         b_conv.is_owned = ptr_is_owned(b);
74016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74017         b_conv.is_owned = false;
74018         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
74019         return ret_conv;
74020 }
74021
74022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
74023         LDKSignedRawBolt11Invoice this_arg_conv;
74024         this_arg_conv.inner = untag_ptr(this_arg);
74025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74027         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
74028         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
74029         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
74030         return tag_ptr(ret_conv, true);
74031 }
74032
74033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
74034         LDKSignedRawBolt11Invoice this_arg_conv;
74035         this_arg_conv.inner = untag_ptr(this_arg);
74036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74038         this_arg_conv.is_owned = false;
74039         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
74040         int64_t ret_ref = 0;
74041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74043         return ret_ref;
74044 }
74045
74046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74047         LDKSignedRawBolt11Invoice this_arg_conv;
74048         this_arg_conv.inner = untag_ptr(this_arg);
74049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74051         this_arg_conv.is_owned = false;
74052         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74053         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
74054         return ret_arr;
74055 }
74056
74057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74058         LDKSignedRawBolt11Invoice this_arg_conv;
74059         this_arg_conv.inner = untag_ptr(this_arg);
74060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74062         this_arg_conv.is_owned = false;
74063         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
74064         int64_t ret_ref = 0;
74065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74067         return ret_ref;
74068 }
74069
74070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74071         LDKSignedRawBolt11Invoice this_arg_conv;
74072         this_arg_conv.inner = untag_ptr(this_arg);
74073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74075         this_arg_conv.is_owned = false;
74076         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
74077         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
74078         return tag_ptr(ret_conv, true);
74079 }
74080
74081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74082         LDKSignedRawBolt11Invoice this_arg_conv;
74083         this_arg_conv.inner = untag_ptr(this_arg);
74084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74086         this_arg_conv.is_owned = false;
74087         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
74088         return ret_conv;
74089 }
74090
74091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74092         LDKRawBolt11Invoice this_arg_conv;
74093         this_arg_conv.inner = untag_ptr(this_arg);
74094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74096         this_arg_conv.is_owned = false;
74097         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
74099         return ret_arr;
74100 }
74101
74102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74103         LDKRawBolt11Invoice this_arg_conv;
74104         this_arg_conv.inner = untag_ptr(this_arg);
74105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74107         this_arg_conv.is_owned = false;
74108         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
74109         int64_t ret_ref = 0;
74110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74112         return ret_ref;
74113 }
74114
74115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
74116         LDKRawBolt11Invoice this_arg_conv;
74117         this_arg_conv.inner = untag_ptr(this_arg);
74118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74120         this_arg_conv.is_owned = false;
74121         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
74122         int64_t ret_ref = 0;
74123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74125         return ret_ref;
74126 }
74127
74128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74129         LDKRawBolt11Invoice this_arg_conv;
74130         this_arg_conv.inner = untag_ptr(this_arg);
74131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74133         this_arg_conv.is_owned = false;
74134         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
74135         int64_t ret_ref = 0;
74136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74138         return ret_ref;
74139 }
74140
74141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74142         LDKRawBolt11Invoice this_arg_conv;
74143         this_arg_conv.inner = untag_ptr(this_arg);
74144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74146         this_arg_conv.is_owned = false;
74147         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
74148         int64_t ret_ref = 0;
74149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74151         return ret_ref;
74152 }
74153
74154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74155         LDKRawBolt11Invoice this_arg_conv;
74156         this_arg_conv.inner = untag_ptr(this_arg);
74157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74159         this_arg_conv.is_owned = false;
74160         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
74161         int64_t ret_ref = 0;
74162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74164         return ret_ref;
74165 }
74166
74167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
74168         LDKRawBolt11Invoice this_arg_conv;
74169         this_arg_conv.inner = untag_ptr(this_arg);
74170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74172         this_arg_conv.is_owned = false;
74173         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
74174         int64_t ret_ref = 0;
74175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74177         return ret_ref;
74178 }
74179
74180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
74181         LDKRawBolt11Invoice this_arg_conv;
74182         this_arg_conv.inner = untag_ptr(this_arg);
74183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74185         this_arg_conv.is_owned = false;
74186         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74187         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
74188         int64_t ret_ref = tag_ptr(ret_copy, true);
74189         return ret_ref;
74190 }
74191
74192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
74193         LDKRawBolt11Invoice this_arg_conv;
74194         this_arg_conv.inner = untag_ptr(this_arg);
74195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74197         this_arg_conv.is_owned = false;
74198         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
74199         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
74200         int64_t ret_ref = tag_ptr(ret_copy, true);
74201         return ret_ref;
74202 }
74203
74204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74205         LDKRawBolt11Invoice this_arg_conv;
74206         this_arg_conv.inner = untag_ptr(this_arg);
74207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74209         this_arg_conv.is_owned = false;
74210         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
74211         int64_t ret_ref = 0;
74212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74214         return ret_ref;
74215 }
74216
74217 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
74218         LDKRawBolt11Invoice 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         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
74224         int64_tArray ret_arr = NULL;
74225         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74226         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74227         for (size_t o = 0; o < ret_var.datalen; o++) {
74228                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
74229                 int64_t ret_conv_14_ref = 0;
74230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
74231                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
74232                 ret_arr_ptr[o] = ret_conv_14_ref;
74233         }
74234         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74235         FREE(ret_var.data);
74236         return ret_arr;
74237 }
74238
74239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
74240         LDKRawBolt11Invoice this_arg_conv;
74241         this_arg_conv.inner = untag_ptr(this_arg);
74242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74244         this_arg_conv.is_owned = false;
74245         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74246         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
74247         int64_t ret_ref = tag_ptr(ret_copy, true);
74248         return ret_ref;
74249 }
74250
74251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
74252         LDKRawBolt11Invoice this_arg_conv;
74253         this_arg_conv.inner = untag_ptr(this_arg);
74254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74256         this_arg_conv.is_owned = false;
74257         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
74258         return ret_conv;
74259 }
74260
74261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
74262         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
74263         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
74264         return tag_ptr(ret_conv, true);
74265 }
74266
74267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
74268         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
74269         *ret_conv = PositiveTimestamp_from_system_time(time);
74270         return tag_ptr(ret_conv, true);
74271 }
74272
74273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
74274         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
74275         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
74276         return tag_ptr(ret_conv, true);
74277 }
74278
74279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
74280         LDKPositiveTimestamp this_arg_conv;
74281         this_arg_conv.inner = untag_ptr(this_arg);
74282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74284         this_arg_conv.is_owned = false;
74285         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
74286         return ret_conv;
74287 }
74288
74289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
74290         LDKPositiveTimestamp this_arg_conv;
74291         this_arg_conv.inner = untag_ptr(this_arg);
74292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74294         this_arg_conv.is_owned = false;
74295         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
74296         return ret_conv;
74297 }
74298
74299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74300         LDKPositiveTimestamp this_arg_conv;
74301         this_arg_conv.inner = untag_ptr(this_arg);
74302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74304         this_arg_conv.is_owned = false;
74305         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
74306         return ret_conv;
74307 }
74308
74309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74310         LDKBolt11Invoice this_arg_conv;
74311         this_arg_conv.inner = untag_ptr(this_arg);
74312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74314         this_arg_conv.is_owned = false;
74315         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
74317         return ret_arr;
74318 }
74319
74320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
74321         LDKBolt11Invoice this_arg_conv;
74322         this_arg_conv.inner = untag_ptr(this_arg);
74323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74325         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
74326         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
74327         int64_t ret_ref = 0;
74328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74330         return ret_ref;
74331 }
74332
74333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74334         LDKBolt11Invoice this_arg_conv;
74335         this_arg_conv.inner = untag_ptr(this_arg);
74336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74338         this_arg_conv.is_owned = false;
74339         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
74340         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
74341         return tag_ptr(ret_conv, true);
74342 }
74343
74344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
74345         LDKSignedRawBolt11Invoice signed_invoice_conv;
74346         signed_invoice_conv.inner = untag_ptr(signed_invoice);
74347         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
74348         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
74349         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
74350         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
74351         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
74352         return tag_ptr(ret_conv, true);
74353 }
74354
74355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
74356         LDKBolt11Invoice this_arg_conv;
74357         this_arg_conv.inner = untag_ptr(this_arg);
74358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74360         this_arg_conv.is_owned = false;
74361         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
74362         return ret_conv;
74363 }
74364
74365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
74366         LDKBolt11Invoice this_arg_conv;
74367         this_arg_conv.inner = untag_ptr(this_arg);
74368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74370         this_arg_conv.is_owned = false;
74371         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
74372         return ret_conv;
74373 }
74374
74375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74376         LDKBolt11Invoice this_arg_conv;
74377         this_arg_conv.inner = untag_ptr(this_arg);
74378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74380         this_arg_conv.is_owned = false;
74381         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74382         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
74383         return ret_arr;
74384 }
74385
74386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74387         LDKBolt11Invoice this_arg_conv;
74388         this_arg_conv.inner = untag_ptr(this_arg);
74389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74391         this_arg_conv.is_owned = false;
74392         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74393         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
74394         return ret_arr;
74395 }
74396
74397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
74398         LDKBolt11Invoice this_arg_conv;
74399         this_arg_conv.inner = untag_ptr(this_arg);
74400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74402         this_arg_conv.is_owned = false;
74403         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74404         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
74405         return ret_arr;
74406 }
74407
74408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
74409         LDKBolt11Invoice this_arg_conv;
74410         this_arg_conv.inner = untag_ptr(this_arg);
74411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74413         this_arg_conv.is_owned = false;
74414         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
74415         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
74416         int64_t ret_ref = tag_ptr(ret_copy, true);
74417         return ret_ref;
74418 }
74419
74420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74421         LDKBolt11Invoice this_arg_conv;
74422         this_arg_conv.inner = untag_ptr(this_arg);
74423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74425         this_arg_conv.is_owned = false;
74426         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
74427         int64_t ret_ref = 0;
74428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74430         return ret_ref;
74431 }
74432
74433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74434         LDKBolt11Invoice this_arg_conv;
74435         this_arg_conv.inner = untag_ptr(this_arg);
74436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74438         this_arg_conv.is_owned = false;
74439         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74440         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
74441         return ret_arr;
74442 }
74443
74444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
74445         LDKBolt11Invoice this_arg_conv;
74446         this_arg_conv.inner = untag_ptr(this_arg);
74447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74449         this_arg_conv.is_owned = false;
74450         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74451         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
74452         int64_t ret_ref = tag_ptr(ret_copy, true);
74453         return ret_ref;
74454 }
74455
74456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74457         LDKBolt11Invoice this_arg_conv;
74458         this_arg_conv.inner = untag_ptr(this_arg);
74459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74461         this_arg_conv.is_owned = false;
74462         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
74463         return ret_conv;
74464 }
74465
74466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
74467         LDKBolt11Invoice this_arg_conv;
74468         this_arg_conv.inner = untag_ptr(this_arg);
74469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74471         this_arg_conv.is_owned = false;
74472         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
74473         return ret_conv;
74474 }
74475
74476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
74477         LDKBolt11Invoice this_arg_conv;
74478         this_arg_conv.inner = untag_ptr(this_arg);
74479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74481         this_arg_conv.is_owned = false;
74482         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
74483         return ret_conv;
74484 }
74485
74486 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) {
74487         LDKBolt11Invoice this_arg_conv;
74488         this_arg_conv.inner = untag_ptr(this_arg);
74489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74491         this_arg_conv.is_owned = false;
74492         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
74493         return ret_conv;
74494 }
74495
74496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
74497         LDKBolt11Invoice this_arg_conv;
74498         this_arg_conv.inner = untag_ptr(this_arg);
74499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74501         this_arg_conv.is_owned = false;
74502         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
74503         return ret_conv;
74504 }
74505
74506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
74507         LDKBolt11Invoice this_arg_conv;
74508         this_arg_conv.inner = untag_ptr(this_arg);
74509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74511         this_arg_conv.is_owned = false;
74512         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
74513         return ret_conv;
74514 }
74515
74516 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
74517         LDKBolt11Invoice 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         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
74523         jobjectArray ret_arr = NULL;
74524         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
74525         ;
74526         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74527         for (size_t i = 0; i < ret_var.datalen; i++) {
74528                 LDKStr ret_conv_8_str = ret_var.data[i];
74529                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
74530                 Str_free(ret_conv_8_str);
74531                 ret_arr_ptr[i] = ret_conv_8_conv;
74532         }
74533         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74534         FREE(ret_var.data);
74535         return ret_arr;
74536 }
74537
74538 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
74539         LDKBolt11Invoice this_arg_conv;
74540         this_arg_conv.inner = untag_ptr(this_arg);
74541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74543         this_arg_conv.is_owned = false;
74544         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
74545         int64_tArray ret_arr = NULL;
74546         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74547         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74548         for (size_t o = 0; o < ret_var.datalen; o++) {
74549                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
74550                 int64_t ret_conv_14_ref = 0;
74551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
74552                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
74553                 ret_arr_ptr[o] = ret_conv_14_ref;
74554         }
74555         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74556         FREE(ret_var.data);
74557         return ret_arr;
74558 }
74559
74560 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
74561         LDKBolt11Invoice this_arg_conv;
74562         this_arg_conv.inner = untag_ptr(this_arg);
74563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74565         this_arg_conv.is_owned = false;
74566         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
74567         int64_tArray ret_arr = NULL;
74568         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74569         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74570         for (size_t l = 0; l < ret_var.datalen; l++) {
74571                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
74572                 int64_t ret_conv_11_ref = 0;
74573                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
74574                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
74575                 ret_arr_ptr[l] = ret_conv_11_ref;
74576         }
74577         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74578         FREE(ret_var.data);
74579         return ret_arr;
74580 }
74581
74582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
74583         LDKBolt11Invoice this_arg_conv;
74584         this_arg_conv.inner = untag_ptr(this_arg);
74585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74587         this_arg_conv.is_owned = false;
74588         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
74589         return ret_conv;
74590 }
74591
74592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
74593         LDKBolt11Invoice this_arg_conv;
74594         this_arg_conv.inner = untag_ptr(this_arg);
74595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74597         this_arg_conv.is_owned = false;
74598         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74599         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
74600         int64_t ret_ref = tag_ptr(ret_copy, true);
74601         return ret_ref;
74602 }
74603
74604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
74605         LDKStr description_conv = java_to_owned_str(env, description);
74606         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
74607         *ret_conv = Description_new(description_conv);
74608         return tag_ptr(ret_conv, true);
74609 }
74610
74611 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
74612         LDKDescription this_arg_conv;
74613         this_arg_conv.inner = untag_ptr(this_arg);
74614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74616         this_arg_conv = Description_clone(&this_arg_conv);
74617         LDKStr ret_str = Description_into_inner(this_arg_conv);
74618         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74619         Str_free(ret_str);
74620         return ret_conv;
74621 }
74622
74623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
74624         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
74625         int64_t ret_ref = 0;
74626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74628         return ret_ref;
74629 }
74630
74631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
74632         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
74633         int64_t ret_ref = 0;
74634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74636         return ret_ref;
74637 }
74638
74639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
74640         LDKExpiryTime this_arg_conv;
74641         this_arg_conv.inner = untag_ptr(this_arg);
74642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74644         this_arg_conv.is_owned = false;
74645         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
74646         return ret_conv;
74647 }
74648
74649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
74650         LDKExpiryTime this_arg_conv;
74651         this_arg_conv.inner = untag_ptr(this_arg);
74652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74654         this_arg_conv.is_owned = false;
74655         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
74656         return ret_conv;
74657 }
74658
74659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
74660         LDKRouteHint hops_conv;
74661         hops_conv.inner = untag_ptr(hops);
74662         hops_conv.is_owned = ptr_is_owned(hops);
74663         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
74664         hops_conv = RouteHint_clone(&hops_conv);
74665         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
74666         *ret_conv = PrivateRoute_new(hops_conv);
74667         return tag_ptr(ret_conv, true);
74668 }
74669
74670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
74671         LDKPrivateRoute this_arg_conv;
74672         this_arg_conv.inner = untag_ptr(this_arg);
74673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74675         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
74676         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
74677         int64_t ret_ref = 0;
74678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74680         return ret_ref;
74681 }
74682
74683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74684         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
74685         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
74686         return ret_conv;
74687 }
74688
74689 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
74690         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
74691         return ret_conv;
74692 }
74693
74694 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
74695         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
74696         return ret_conv;
74697 }
74698
74699 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
74700         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
74701         return ret_conv;
74702 }
74703
74704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
74705         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
74706         return ret_conv;
74707 }
74708
74709 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
74710         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
74711         return ret_conv;
74712 }
74713
74714 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
74715         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
74716         return ret_conv;
74717 }
74718
74719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74720         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
74721         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
74722         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
74723         return ret_conv;
74724 }
74725
74726 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74727         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
74728         LDKStr ret_str = CreationError_to_str(o_conv);
74729         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74730         Str_free(ret_str);
74731         return ret_conv;
74732 }
74733
74734 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74735         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
74736         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
74737         return ret_conv;
74738 }
74739
74740 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
74741         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
74742         return ret_conv;
74743 }
74744
74745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
74746         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
74747         return ret_conv;
74748 }
74749
74750 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
74751         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
74752         return ret_conv;
74753 }
74754
74755 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
74756         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
74757         return ret_conv;
74758 }
74759
74760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
74761         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
74762         return ret_conv;
74763 }
74764
74765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
74766         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
74767         return ret_conv;
74768 }
74769
74770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
74771         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
74772         return ret_conv;
74773 }
74774
74775 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
74776         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
74777         return ret_conv;
74778 }
74779
74780 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
74781         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
74782         return ret_conv;
74783 }
74784
74785 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
74786         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
74787         return ret_conv;
74788 }
74789
74790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74791         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
74792         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
74793         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
74794         return ret_conv;
74795 }
74796
74797 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74798         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
74799         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
74800         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74801         Str_free(ret_str);
74802         return ret_conv;
74803 }
74804
74805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74806         if (!ptr_is_owned(this_ptr)) return;
74807         void* this_ptr_ptr = untag_ptr(this_ptr);
74808         CHECK_ACCESS(this_ptr_ptr);
74809         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
74810         FREE(untag_ptr(this_ptr));
74811         SignOrCreationError_free(this_ptr_conv);
74812 }
74813
74814 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
74815         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74816         *ret_copy = SignOrCreationError_clone(arg);
74817         int64_t ret_ref = tag_ptr(ret_copy, true);
74818         return ret_ref;
74819 }
74820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74821         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
74822         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
74823         return ret_conv;
74824 }
74825
74826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74827         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
74828         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74829         *ret_copy = SignOrCreationError_clone(orig_conv);
74830         int64_t ret_ref = tag_ptr(ret_copy, true);
74831         return ret_ref;
74832 }
74833
74834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
74835         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74836         *ret_copy = SignOrCreationError_sign_error();
74837         int64_t ret_ref = tag_ptr(ret_copy, true);
74838         return ret_ref;
74839 }
74840
74841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
74842         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
74843         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74844         *ret_copy = SignOrCreationError_creation_error(a_conv);
74845         int64_t ret_ref = tag_ptr(ret_copy, true);
74846         return ret_ref;
74847 }
74848
74849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74850         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
74851         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
74852         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
74853         return ret_conv;
74854 }
74855
74856 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74857         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
74858         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
74859         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74860         Str_free(ret_str);
74861         return ret_conv;
74862 }
74863
74864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t retry_strategy, int64_t channelmanager) {
74865         LDKBolt11Invoice invoice_conv;
74866         invoice_conv.inner = untag_ptr(invoice);
74867         invoice_conv.is_owned = ptr_is_owned(invoice);
74868         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74869         invoice_conv.is_owned = false;
74870         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74871         CHECK_ACCESS(retry_strategy_ptr);
74872         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74873         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74874         LDKChannelManager channelmanager_conv;
74875         channelmanager_conv.inner = untag_ptr(channelmanager);
74876         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74877         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74878         channelmanager_conv.is_owned = false;
74879         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
74880         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
74881         return tag_ptr(ret_conv, true);
74882 }
74883
74884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
74885         LDKBolt11Invoice invoice_conv;
74886         invoice_conv.inner = untag_ptr(invoice);
74887         invoice_conv.is_owned = ptr_is_owned(invoice);
74888         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74889         invoice_conv.is_owned = false;
74890         LDKThirtyTwoBytes payment_id_ref;
74891         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
74892         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
74893         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74894         CHECK_ACCESS(retry_strategy_ptr);
74895         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74896         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74897         LDKChannelManager channelmanager_conv;
74898         channelmanager_conv.inner = untag_ptr(channelmanager);
74899         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74900         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74901         channelmanager_conv.is_owned = false;
74902         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
74903         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
74904         return tag_ptr(ret_conv, true);
74905 }
74906
74907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int64_t retry_strategy, int64_t channelmanager) {
74908         LDKBolt11Invoice invoice_conv;
74909         invoice_conv.inner = untag_ptr(invoice);
74910         invoice_conv.is_owned = ptr_is_owned(invoice);
74911         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74912         invoice_conv.is_owned = false;
74913         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74914         CHECK_ACCESS(retry_strategy_ptr);
74915         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74916         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74917         LDKChannelManager channelmanager_conv;
74918         channelmanager_conv.inner = untag_ptr(channelmanager);
74919         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74920         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74921         channelmanager_conv.is_owned = false;
74922         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
74923         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
74924         return tag_ptr(ret_conv, true);
74925 }
74926
74927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
74928         LDKBolt11Invoice invoice_conv;
74929         invoice_conv.inner = untag_ptr(invoice);
74930         invoice_conv.is_owned = ptr_is_owned(invoice);
74931         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74932         invoice_conv.is_owned = false;
74933         LDKThirtyTwoBytes payment_id_ref;
74934         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
74935         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
74936         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74937         CHECK_ACCESS(retry_strategy_ptr);
74938         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74939         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74940         LDKChannelManager channelmanager_conv;
74941         channelmanager_conv.inner = untag_ptr(channelmanager);
74942         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74943         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74944         channelmanager_conv.is_owned = false;
74945         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
74946         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
74947         return tag_ptr(ret_conv, true);
74948 }
74949
74950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_preflight_1probe_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t channelmanager, int64_t liquidity_limit_multiplier) {
74951         LDKBolt11Invoice invoice_conv;
74952         invoice_conv.inner = untag_ptr(invoice);
74953         invoice_conv.is_owned = ptr_is_owned(invoice);
74954         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74955         invoice_conv.is_owned = false;
74956         LDKChannelManager channelmanager_conv;
74957         channelmanager_conv.inner = untag_ptr(channelmanager);
74958         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74959         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74960         channelmanager_conv.is_owned = false;
74961         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
74962         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
74963         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
74964         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
74965         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
74966         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
74967         return tag_ptr(ret_conv, true);
74968 }
74969
74970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_preflight_1probe_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msat, int64_t channelmanager, int64_t liquidity_limit_multiplier) {
74971         LDKBolt11Invoice invoice_conv;
74972         invoice_conv.inner = untag_ptr(invoice);
74973         invoice_conv.is_owned = ptr_is_owned(invoice);
74974         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74975         invoice_conv.is_owned = false;
74976         LDKChannelManager channelmanager_conv;
74977         channelmanager_conv.inner = untag_ptr(channelmanager);
74978         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74979         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74980         channelmanager_conv.is_owned = false;
74981         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
74982         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
74983         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
74984         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
74985         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
74986         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
74987         return tag_ptr(ret_conv, true);
74988 }
74989
74990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74991         if (!ptr_is_owned(this_ptr)) return;
74992         void* this_ptr_ptr = untag_ptr(this_ptr);
74993         CHECK_ACCESS(this_ptr_ptr);
74994         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
74995         FREE(untag_ptr(this_ptr));
74996         PaymentError_free(this_ptr_conv);
74997 }
74998
74999 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
75000         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75001         *ret_copy = PaymentError_clone(arg);
75002         int64_t ret_ref = tag_ptr(ret_copy, true);
75003         return ret_ref;
75004 }
75005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75006         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
75007         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
75008         return ret_conv;
75009 }
75010
75011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75012         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
75013         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75014         *ret_copy = PaymentError_clone(orig_conv);
75015         int64_t ret_ref = tag_ptr(ret_copy, true);
75016         return ret_ref;
75017 }
75018
75019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75020         LDKStr a_conv = java_to_owned_str(env, a);
75021         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75022         *ret_copy = PaymentError_invoice(a_conv);
75023         int64_t ret_ref = tag_ptr(ret_copy, true);
75024         return ret_ref;
75025 }
75026
75027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
75028         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
75029         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75030         *ret_copy = PaymentError_sending(a_conv);
75031         int64_t ret_ref = tag_ptr(ret_copy, true);
75032         return ret_ref;
75033 }
75034
75035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75036         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
75037         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
75038         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
75039         return ret_conv;
75040 }
75041
75042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbingError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75043         if (!ptr_is_owned(this_ptr)) return;
75044         void* this_ptr_ptr = untag_ptr(this_ptr);
75045         CHECK_ACCESS(this_ptr_ptr);
75046         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
75047         FREE(untag_ptr(this_ptr));
75048         ProbingError_free(this_ptr_conv);
75049 }
75050
75051 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
75052         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75053         *ret_copy = ProbingError_clone(arg);
75054         int64_t ret_ref = tag_ptr(ret_copy, true);
75055         return ret_ref;
75056 }
75057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75058         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
75059         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
75060         return ret_conv;
75061 }
75062
75063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75064         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
75065         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75066         *ret_copy = ProbingError_clone(orig_conv);
75067         int64_t ret_ref = tag_ptr(ret_copy, true);
75068         return ret_ref;
75069 }
75070
75071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75072         LDKStr a_conv = java_to_owned_str(env, a);
75073         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75074         *ret_copy = ProbingError_invoice(a_conv);
75075         int64_t ret_ref = tag_ptr(ret_copy, true);
75076         return ret_ref;
75077 }
75078
75079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1sending(JNIEnv *env, jclass clz, int64_t a) {
75080         void* a_ptr = untag_ptr(a);
75081         CHECK_ACCESS(a_ptr);
75082         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
75083         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
75084         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75085         *ret_copy = ProbingError_sending(a_conv);
75086         int64_t ret_ref = tag_ptr(ret_copy, true);
75087         return ret_ref;
75088 }
75089
75090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbingError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75091         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
75092         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
75093         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
75094         return ret_conv;
75095 }
75096
75097 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) {
75098         void* amt_msat_ptr = untag_ptr(amt_msat);
75099         CHECK_ACCESS(amt_msat_ptr);
75100         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75101         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75102         void* payment_hash_ptr = untag_ptr(payment_hash);
75103         CHECK_ACCESS(payment_hash_ptr);
75104         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75105         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75106         LDKStr description_conv = java_to_owned_str(env, description);
75107         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75108         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75109         if (phantom_route_hints_constr.datalen > 0)
75110                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75111         else
75112                 phantom_route_hints_constr.data = NULL;
75113         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75114         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75115                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75116                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75117                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75118                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75119                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75120                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75121                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75122         }
75123         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75124         void* entropy_source_ptr = untag_ptr(entropy_source);
75125         CHECK_ACCESS(entropy_source_ptr);
75126         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75127         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75128                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75129                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75130         }
75131         void* node_signer_ptr = untag_ptr(node_signer);
75132         CHECK_ACCESS(node_signer_ptr);
75133         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75134         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75135                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75136                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75137         }
75138         void* logger_ptr = untag_ptr(logger);
75139         CHECK_ACCESS(logger_ptr);
75140         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75141         if (logger_conv.free == LDKLogger_JCalls_free) {
75142                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75143                 LDKLogger_JCalls_cloned(&logger_conv);
75144         }
75145         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75146         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75147         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75148         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75149         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75150         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75151         *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);
75152         return tag_ptr(ret_conv, true);
75153 }
75154
75155 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) {
75156         void* amt_msat_ptr = untag_ptr(amt_msat);
75157         CHECK_ACCESS(amt_msat_ptr);
75158         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75159         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75160         void* payment_hash_ptr = untag_ptr(payment_hash);
75161         CHECK_ACCESS(payment_hash_ptr);
75162         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75163         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75164         LDKSha256 description_hash_conv;
75165         description_hash_conv.inner = untag_ptr(description_hash);
75166         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75167         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75168         description_hash_conv = Sha256_clone(&description_hash_conv);
75169         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75170         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75171         if (phantom_route_hints_constr.datalen > 0)
75172                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75173         else
75174                 phantom_route_hints_constr.data = NULL;
75175         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75176         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75177                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75178                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75179                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75180                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75181                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75182                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75183                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75184         }
75185         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75186         void* entropy_source_ptr = untag_ptr(entropy_source);
75187         CHECK_ACCESS(entropy_source_ptr);
75188         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75189         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75191                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75192         }
75193         void* node_signer_ptr = untag_ptr(node_signer);
75194         CHECK_ACCESS(node_signer_ptr);
75195         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75196         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75197                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75198                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75199         }
75200         void* logger_ptr = untag_ptr(logger);
75201         CHECK_ACCESS(logger_ptr);
75202         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75203         if (logger_conv.free == LDKLogger_JCalls_free) {
75204                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75205                 LDKLogger_JCalls_cloned(&logger_conv);
75206         }
75207         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75208         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75209         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75210         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75211         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75212         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75213         *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);
75214         return tag_ptr(ret_conv, true);
75215 }
75216
75217 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) {
75218         LDKChannelManager channelmanager_conv;
75219         channelmanager_conv.inner = untag_ptr(channelmanager);
75220         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75221         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75222         channelmanager_conv.is_owned = false;
75223         void* node_signer_ptr = untag_ptr(node_signer);
75224         CHECK_ACCESS(node_signer_ptr);
75225         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75226         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75228                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75229         }
75230         void* logger_ptr = untag_ptr(logger);
75231         CHECK_ACCESS(logger_ptr);
75232         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75233         if (logger_conv.free == LDKLogger_JCalls_free) {
75234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75235                 LDKLogger_JCalls_cloned(&logger_conv);
75236         }
75237         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75238         void* amt_msat_ptr = untag_ptr(amt_msat);
75239         CHECK_ACCESS(amt_msat_ptr);
75240         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75241         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75242         LDKStr description_conv = java_to_owned_str(env, description);
75243         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75244         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75245         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75246         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75247         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75248         *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);
75249         return tag_ptr(ret_conv, true);
75250 }
75251
75252 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) {
75253         LDKChannelManager channelmanager_conv;
75254         channelmanager_conv.inner = untag_ptr(channelmanager);
75255         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75256         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75257         channelmanager_conv.is_owned = false;
75258         void* node_signer_ptr = untag_ptr(node_signer);
75259         CHECK_ACCESS(node_signer_ptr);
75260         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75261         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75263                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75264         }
75265         void* logger_ptr = untag_ptr(logger);
75266         CHECK_ACCESS(logger_ptr);
75267         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75268         if (logger_conv.free == LDKLogger_JCalls_free) {
75269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75270                 LDKLogger_JCalls_cloned(&logger_conv);
75271         }
75272         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75273         void* amt_msat_ptr = untag_ptr(amt_msat);
75274         CHECK_ACCESS(amt_msat_ptr);
75275         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75276         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75277         LDKSha256 description_hash_conv;
75278         description_hash_conv.inner = untag_ptr(description_hash);
75279         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75280         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75281         description_hash_conv = Sha256_clone(&description_hash_conv);
75282         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75283         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75284         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75285         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75286         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75287         *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);
75288         return tag_ptr(ret_conv, true);
75289 }
75290
75291 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) {
75292         LDKChannelManager channelmanager_conv;
75293         channelmanager_conv.inner = untag_ptr(channelmanager);
75294         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75295         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75296         channelmanager_conv.is_owned = false;
75297         void* node_signer_ptr = untag_ptr(node_signer);
75298         CHECK_ACCESS(node_signer_ptr);
75299         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75300         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75301                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75302                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75303         }
75304         void* logger_ptr = untag_ptr(logger);
75305         CHECK_ACCESS(logger_ptr);
75306         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75307         if (logger_conv.free == LDKLogger_JCalls_free) {
75308                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75309                 LDKLogger_JCalls_cloned(&logger_conv);
75310         }
75311         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75312         void* amt_msat_ptr = untag_ptr(amt_msat);
75313         CHECK_ACCESS(amt_msat_ptr);
75314         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75315         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75316         LDKSha256 description_hash_conv;
75317         description_hash_conv.inner = untag_ptr(description_hash);
75318         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75319         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75320         description_hash_conv = Sha256_clone(&description_hash_conv);
75321         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75322         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75323         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75324         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75325         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75326         *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);
75327         return tag_ptr(ret_conv, true);
75328 }
75329
75330 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) {
75331         LDKChannelManager channelmanager_conv;
75332         channelmanager_conv.inner = untag_ptr(channelmanager);
75333         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75334         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75335         channelmanager_conv.is_owned = false;
75336         void* node_signer_ptr = untag_ptr(node_signer);
75337         CHECK_ACCESS(node_signer_ptr);
75338         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75339         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75341                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75342         }
75343         void* logger_ptr = untag_ptr(logger);
75344         CHECK_ACCESS(logger_ptr);
75345         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75346         if (logger_conv.free == LDKLogger_JCalls_free) {
75347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75348                 LDKLogger_JCalls_cloned(&logger_conv);
75349         }
75350         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75351         void* amt_msat_ptr = untag_ptr(amt_msat);
75352         CHECK_ACCESS(amt_msat_ptr);
75353         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75354         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75355         LDKStr description_conv = java_to_owned_str(env, description);
75356         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75357         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75358         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75359         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75360         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75361         *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);
75362         return tag_ptr(ret_conv, true);
75363 }
75364
75365 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) {
75366         LDKChannelManager channelmanager_conv;
75367         channelmanager_conv.inner = untag_ptr(channelmanager);
75368         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75369         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75370         channelmanager_conv.is_owned = false;
75371         void* node_signer_ptr = untag_ptr(node_signer);
75372         CHECK_ACCESS(node_signer_ptr);
75373         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75374         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75375                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75376                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75377         }
75378         void* logger_ptr = untag_ptr(logger);
75379         CHECK_ACCESS(logger_ptr);
75380         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75381         if (logger_conv.free == LDKLogger_JCalls_free) {
75382                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75383                 LDKLogger_JCalls_cloned(&logger_conv);
75384         }
75385         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75386         void* amt_msat_ptr = untag_ptr(amt_msat);
75387         CHECK_ACCESS(amt_msat_ptr);
75388         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75389         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75390         LDKStr description_conv = java_to_owned_str(env, description);
75391         LDKThirtyTwoBytes payment_hash_ref;
75392         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
75393         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
75394         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75395         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75396         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75397         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75398         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75399         *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);
75400         return tag_ptr(ret_conv, true);
75401 }
75402
75403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
75404         LDKStr s_conv = java_to_owned_str(env, s);
75405         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
75406         *ret_conv = SiPrefix_from_str(s_conv);
75407         return tag_ptr(ret_conv, true);
75408 }
75409
75410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
75411         LDKStr s_conv = java_to_owned_str(env, s);
75412         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
75413         *ret_conv = Bolt11Invoice_from_str(s_conv);
75414         return tag_ptr(ret_conv, true);
75415 }
75416
75417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
75418         LDKStr s_conv = java_to_owned_str(env, s);
75419         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
75420         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
75421         return tag_ptr(ret_conv, true);
75422 }
75423
75424 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75425         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
75426         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
75427         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75428         Str_free(ret_str);
75429         return ret_conv;
75430 }
75431
75432 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75433         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
75434         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
75435         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75436         Str_free(ret_str);
75437         return ret_conv;
75438 }
75439
75440 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75441         LDKBolt11Invoice o_conv;
75442         o_conv.inner = untag_ptr(o);
75443         o_conv.is_owned = ptr_is_owned(o);
75444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75445         o_conv.is_owned = false;
75446         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
75447         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75448         Str_free(ret_str);
75449         return ret_conv;
75450 }
75451
75452 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75453         LDKSignedRawBolt11Invoice o_conv;
75454         o_conv.inner = untag_ptr(o);
75455         o_conv.is_owned = ptr_is_owned(o);
75456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75457         o_conv.is_owned = false;
75458         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
75459         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75460         Str_free(ret_str);
75461         return ret_conv;
75462 }
75463
75464 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75465         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
75466         LDKStr ret_str = Currency_to_str(o_conv);
75467         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75468         Str_free(ret_str);
75469         return ret_conv;
75470 }
75471
75472 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75473         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
75474         LDKStr ret_str = SiPrefix_to_str(o_conv);
75475         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75476         Str_free(ret_str);
75477         return ret_conv;
75478 }
75479
75480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75481         LDKRapidGossipSync this_obj_conv;
75482         this_obj_conv.inner = untag_ptr(this_obj);
75483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75485         RapidGossipSync_free(this_obj_conv);
75486 }
75487
75488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
75489         LDKNetworkGraph network_graph_conv;
75490         network_graph_conv.inner = untag_ptr(network_graph);
75491         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75492         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75493         network_graph_conv.is_owned = false;
75494         void* logger_ptr = untag_ptr(logger);
75495         CHECK_ACCESS(logger_ptr);
75496         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75497         if (logger_conv.free == LDKLogger_JCalls_free) {
75498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75499                 LDKLogger_JCalls_cloned(&logger_conv);
75500         }
75501         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
75502         int64_t ret_ref = 0;
75503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75505         return ret_ref;
75506 }
75507
75508 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) {
75509         LDKRapidGossipSync this_arg_conv;
75510         this_arg_conv.inner = untag_ptr(this_arg);
75511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75513         this_arg_conv.is_owned = false;
75514         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
75515         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
75516         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
75517         return tag_ptr(ret_conv, true);
75518 }
75519
75520 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) {
75521         LDKRapidGossipSync this_arg_conv;
75522         this_arg_conv.inner = untag_ptr(this_arg);
75523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75525         this_arg_conv.is_owned = false;
75526         LDKu8slice update_data_ref;
75527         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
75528         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
75529         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
75530         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
75531         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
75532         return tag_ptr(ret_conv, true);
75533 }
75534
75535 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) {
75536         LDKRapidGossipSync this_arg_conv;
75537         this_arg_conv.inner = untag_ptr(this_arg);
75538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75540         this_arg_conv.is_owned = false;
75541         LDKu8slice update_data_ref;
75542         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
75543         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
75544         void* current_time_unix_ptr = untag_ptr(current_time_unix);
75545         CHECK_ACCESS(current_time_unix_ptr);
75546         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
75547         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
75548         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
75549         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
75550         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
75551         return tag_ptr(ret_conv, true);
75552 }
75553
75554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
75555         LDKRapidGossipSync this_arg_conv;
75556         this_arg_conv.inner = untag_ptr(this_arg);
75557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75559         this_arg_conv.is_owned = false;
75560         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
75561         return ret_conv;
75562 }
75563
75564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75565         if (!ptr_is_owned(this_ptr)) return;
75566         void* this_ptr_ptr = untag_ptr(this_ptr);
75567         CHECK_ACCESS(this_ptr_ptr);
75568         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
75569         FREE(untag_ptr(this_ptr));
75570         GraphSyncError_free(this_ptr_conv);
75571 }
75572
75573 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
75574         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75575         *ret_copy = GraphSyncError_clone(arg);
75576         int64_t ret_ref = tag_ptr(ret_copy, true);
75577         return ret_ref;
75578 }
75579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75580         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
75581         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
75582         return ret_conv;
75583 }
75584
75585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75586         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
75587         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75588         *ret_copy = GraphSyncError_clone(orig_conv);
75589         int64_t ret_ref = tag_ptr(ret_copy, true);
75590         return ret_ref;
75591 }
75592
75593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
75594         void* a_ptr = untag_ptr(a);
75595         CHECK_ACCESS(a_ptr);
75596         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
75597         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
75598         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75599         *ret_copy = GraphSyncError_decode_error(a_conv);
75600         int64_t ret_ref = tag_ptr(ret_copy, true);
75601         return ret_ref;
75602 }
75603
75604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
75605         LDKLightningError a_conv;
75606         a_conv.inner = untag_ptr(a);
75607         a_conv.is_owned = ptr_is_owned(a);
75608         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75609         a_conv = LightningError_clone(&a_conv);
75610         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75611         *ret_copy = GraphSyncError_lightning_error(a_conv);
75612         int64_t ret_ref = tag_ptr(ret_copy, true);
75613         return ret_ref;
75614 }
75615